Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. no value selected from DropDownList

no value selected from DropDownList

Scheduled Pinned Locked Moved ASP.NET
questiondesigntutorial
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    LovelyHelp
    wrote on last edited by
    #1

    I have a dropdownlist with number which will show the number of text field with the number i selected. My code behind is as below but I found there is no selected value running in my code. Is my code correct? example if I select number 2 in my dropdownlist then the item in my placeHolder will show 2 times. ------------------------------------------------------------------------ Partial Class Admin_AddTest Inherits System.Web.UI.Page Dim value As Integer Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If User.Identity.IsAuthenticated = True Then LoadDisplay(value) Else Response.Redirect("default.aspx") End If End Sub Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged ' If Page.IsPostBack Then value = DropDownList1.SelectedItem.Value LoadDisplay(value) ' End If End Sub Private Sub LoadDisplay(ByVal intValue As Integer) Dim i As Integer Dim txtLabel1 As New Label Dim lblQues As New Label Dim lblAns As New Label For i = 0 To value 'display type of question txtLabel1.Text = "
    Type of question
    " plhHolder.Controls.Add(txtLabel1) Dim optMulChoice As New RadioButton() Dim optTrueFalse As New RadioButton() optMulChoice.Text = "   Multiple Answer
    " optMulChoice.GroupName = "MultipleAnswer" optMulChoice.ID = "rbtMulChoice" plhHolder.Controls.Add(txtLabel2) plhHolder.Controls.Add(optMulChoice) optTrueFalse.Text = "   True/False

    " optTrueFalse.GroupName = "TrueFalse" optTrueFalse.ID = "rbtTrueFalse" plhHolder.Controls.Add(txtLabel3) plhHolder.Controls.Add(optTrueFalse) lblQues.Text = "
    Question:
    " plhHolder.Controls.Add(lblQues) Dim txtQues As New TextBox txtQues.ID = "txtQues" txtQues.TextMode = TextBoxMode.MultiLine plhHolder.Controls.Add(txtQues) lblAns.Text = "

    Answer:
    " plhHolder.Controls.Add(lblAns) Dim optAnsA As New RadioButton() Dim optAnsB As New RadioButton() Dim optAnsC As New Rad

    L 1 Reply Last reply
    0
    • L LovelyHelp

      I have a dropdownlist with number which will show the number of text field with the number i selected. My code behind is as below but I found there is no selected value running in my code. Is my code correct? example if I select number 2 in my dropdownlist then the item in my placeHolder will show 2 times. ------------------------------------------------------------------------ Partial Class Admin_AddTest Inherits System.Web.UI.Page Dim value As Integer Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If User.Identity.IsAuthenticated = True Then LoadDisplay(value) Else Response.Redirect("default.aspx") End If End Sub Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged ' If Page.IsPostBack Then value = DropDownList1.SelectedItem.Value LoadDisplay(value) ' End If End Sub Private Sub LoadDisplay(ByVal intValue As Integer) Dim i As Integer Dim txtLabel1 As New Label Dim lblQues As New Label Dim lblAns As New Label For i = 0 To value 'display type of question txtLabel1.Text = "
      Type of question
      " plhHolder.Controls.Add(txtLabel1) Dim optMulChoice As New RadioButton() Dim optTrueFalse As New RadioButton() optMulChoice.Text = "   Multiple Answer
      " optMulChoice.GroupName = "MultipleAnswer" optMulChoice.ID = "rbtMulChoice" plhHolder.Controls.Add(txtLabel2) plhHolder.Controls.Add(optMulChoice) optTrueFalse.Text = "   True/False

      " optTrueFalse.GroupName = "TrueFalse" optTrueFalse.ID = "rbtTrueFalse" plhHolder.Controls.Add(txtLabel3) plhHolder.Controls.Add(optTrueFalse) lblQues.Text = "
      Question:
      " plhHolder.Controls.Add(lblQues) Dim txtQues As New TextBox txtQues.ID = "txtQues" txtQues.TextMode = TextBoxMode.MultiLine plhHolder.Controls.Add(txtQues) lblAns.Text = "

      Answer:
      " plhHolder.Controls.Add(lblAns) Dim optAnsA As New RadioButton() Dim optAnsB As New RadioButton() Dim optAnsC As New Rad

      L Offline
      L Offline
      LovelyHelp
      wrote on last edited by
      #2

      Is any one can help? I am in urgent. I will like my item to repeat as the number that i have selected from drop downlist.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups