Get Control Value From GridView
-
Respected, I have taken DropDownList and checkBox control in a Grid problem is when dropDown select of specific GridView row the CheckBox on the GridView selected row should be unCheck Please help me. Thanks
-
Respected, I have taken DropDownList and checkBox control in a Grid problem is when dropDown select of specific GridView row the CheckBox on the GridView selected row should be unCheck Please help me. Thanks
From : Accessing the different controls inside a GridView control[^]
foreach (GridViewRow row in GridView1.Rows)
{
// Selects the text from the TextBox// which is inside the GridView control string textBoxText = \_ ((TextBox)row.FindControl("TextBox1")).Text; Response.Write(textBoxText); // Selects the text from the DropDownList // which is inside the GridView control string dropDownListText = ((DropDownList) row.FindControl("DropDownList1")).SelectedItem.Value; Response.Write(dropDownListText); // Selects items from the ListBox // which is inside the GridView control ListBox myListBox = (ListBox)row.FindControl("ListBox1"); foreach(ListItem selectedItem in myListBox.Items) { // Checks if the item in the ListBox is selected or not if (selectedItem.Selected) { // Print the value of the item if its selected Response.Write(selectedItem.Value); } } }
-
Respected, I have taken DropDownList and checkBox control in a Grid problem is when dropDown select of specific GridView row the CheckBox on the GridView selected row should be unCheck Please help me. Thanks