Problem with DropDownList inside a gridview
-
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;
-
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;
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)
-
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)
i want help for bind data on dropdown selectedindex_changed event