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. Dropdown lists

Dropdown lists

Scheduled Pinned Locked Moved ASP.NET
helpdebugging
2 Posts 2 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.
  • H Offline
    H Offline
    hahii
    wrote on last edited by
    #1

    I have a problem. I have two dropdown lists in my web page. named ddlApplication and ddlPermission and I have a button. I have two items in each dropdown list but when I choose second item and click on button and debug by using these lines of code it always gives me value of first item. How should I fix this problem. string str2 = this.ddlApplication.SelectedItem.Text; string str3 = this.ddlPermission.SelectedItem.Text; hahii

    S 1 Reply Last reply
    0
    • H hahii

      I have a problem. I have two dropdown lists in my web page. named ddlApplication and ddlPermission and I have a button. I have two items in each dropdown list but when I choose second item and click on button and debug by using these lines of code it always gives me value of first item. How should I fix this problem. string str2 = this.ddlApplication.SelectedItem.Text; string str3 = this.ddlPermission.SelectedItem.Text; hahii

      S Offline
      S Offline
      Sujit Gupta
      wrote on last edited by
      #2

      This is solution for you Check it on your system protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DropDownList1.SelectedIndex = 0; DropDownList2.SelectedIndex = 0; } } protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { Response.Write(DropDownList1.SelectedValue); Response.Write(DropDownList2.SelectedValue); }

      Sujit

      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