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. Dropdownlist in Grid View

Dropdownlist in Grid View

Scheduled Pinned Locked Moved ASP.NET
cssdatabase
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.
  • B Offline
    B Offline
    banker_kiran
    wrote on last edited by
    #1

    Hi, I have one gridview control with two hidden fields and one dropdownlist. AutoPostback property of dropdownlist is true. Now , when selected_index_changed event of dropdownlist fire, that time i want to know that at which row index dropdownlist is.

    kiranbanker

    N 1 Reply Last reply
    0
    • B banker_kiran

      Hi, I have one gridview control with two hidden fields and one dropdownlist. AutoPostback property of dropdownlist is true. Now , when selected_index_changed event of dropdownlist fire, that time i want to know that at which row index dropdownlist is.

      kiranbanker

      N Offline
      N Offline
      NetBot
      wrote on last edited by
      #2

      I have one gridview control with two hidden fields and one dropdownlist. AutoPostback property of dropdownlist is true. You can use Item template for inserting a dropdownlist in the datagrid . Now , when selected_index_changed event of dropdownlist fire, that time i want to know that at which row index dropdownlist is. Now in the code behind write the following code. protected void DropDown_SelectedIndexChanged(object sender, EventArgs e) { DropDownList list = (DropDownList)sender; if(list.SelectedItem.Text=="......."; ..... //To get the corresponding row TableCell cell = list.Parent as TableCell;// getting the parent cell of dropdown DataGridItem item = cell.Parent as DataGridItem;//getting the parent of tablecell ie the row string p_key=item.Cells[2].Text.Trim();//getting the column values of the row ........ Tickle your brain and the ideas are out

      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