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. Problem with DropDownList inside a gridview

Problem with DropDownList inside a gridview

Scheduled Pinned Locked Moved ASP.NET
helpdatabase
3 Posts 3 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.
  • M Offline
    M Offline
    mithun narayanan
    wrote on last edited by
    #1

    i have a drop down list inside a gridview,i need to get the selecteditem.value of the selected item ,but i am getting only the value for the first item only,even if i select any other item.. heres the code i used plz help me... int index = Convert.ToInt32(e.CommandArgument); GridViewRow selectedRow = ((GridView)e.CommandSource).Rows[index]; string value = selectedRow.Cells[0].Text; DropDownList ddl = (DropDownList)selectedRow.Cells[5].FindControl("ddlVendorName"); string mystr = ddl.SelectedItem.value;

    M 1 Reply Last reply
    0
    • M mithun narayanan

      i have a drop down list inside a gridview,i need to get the selecteditem.value of the selected item ,but i am getting only the value for the first item only,even if i select any other item.. heres the code i used plz help me... int index = Convert.ToInt32(e.CommandArgument); GridViewRow selectedRow = ((GridView)e.CommandSource).Rows[index]; string value = selectedRow.Cells[0].Text; DropDownList ddl = (DropDownList)selectedRow.Cells[5].FindControl("ddlVendorName"); string mystr = ddl.SelectedItem.value;

      M Offline
      M Offline
      Michael Sync
      wrote on last edited by
      #2

      mithun narayanan wrote:

      GridViewRow selectedRow = ((GridView)e.CommandSource).Rows[index];

      I think this code might be wrong. As you are getting only one selected row, you won't get the list of rows that you want. So, maybe. You should try to for-loop all rows and get the value..

      Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)

      M 1 Reply Last reply
      0
      • M Michael Sync

        mithun narayanan wrote:

        GridViewRow selectedRow = ((GridView)e.CommandSource).Rows[index];

        I think this code might be wrong. As you are getting only one selected row, you won't get the list of rows that you want. So, maybe. You should try to for-loop all rows and get the value..

        Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)

        M Offline
        M Offline
        meetsheetal
        wrote on last edited by
        #3

        i want help for bind data on dropdown selectedindex_changed event

        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