Control Index

R

rn5a

A Form has only a DataGrid control. Using EditCommandColumn in the
DataGrid, when a row is in the editable mode i.e. the BoundColumns get
replaced by TextBoxes, the Text in the TextBox existing in the first
cell can be accessed in the, say, UpdateCommand event handler of the
DataGrid using

ea.Item.Cells(0).Controls(0)

Similalrly, the Text in the TextBox existing in the third column can be
accessed using

ea.Item.Cells(2).Controls(0)

so on & so forth. If I am not wrong, Controls(0) here refers to the
DataGrid control. The control index of the DataGrid here is 0 since
there are no other controls in the page (please correct me if I am
wrong). But how do I find out what is the control index of the DataGrid
if there are multiple controls in an ASPX page or/and controls are
being added dynamically to the page?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Controls 3
Get BoundColumn Data 0
Insert Null Value 2
Specified argument was out of the range of valid values 0
Controls in ItemTemplate in DataGrid 0
Controls 2
BoundColumn TextBox 2
Cells.Controls 0

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top