c# - How to find all controls in Gridview? -
i have gridview
contains controls checkbox dropdownlist textbox
etc.. these controls in templatefield
, in updatepanel
in gridview. there edittemplatefield
has controls , button
. when grid in edit mode, have find controls in edittemplatefield in button click event
. know can done using foreach loop don't know how?
you can use grid editindex find row contains controls in edit mode. there can control using control id.
textbox txtitem = (textbox)grid1.rows[grid1.editindex].findcontrol("txtitem");
to find controls try this:
foreach(control c in grid1.rows[grid1.editindex].controls) { // stuff in here. }
if have container controls in row, , need find things inside of them, need do recurse down controls.
i don't understand though why need loop though controls, controls in edit template fixed, , know accessing them directly findcontrol way go.
Comments
Post a Comment