Link to home
Start Free TrialLog in
Avatar of stretch73
stretch73Flag for United States of America

asked on

Gridview Findcontrol

I'm using the following code to find a textbox:

txtM1Amt = e.Row.Controls(4).FindControl("txtM1Amt_add")

I inherited this application and I'm just curious as to how it works.  I follow that the row has a controls collection but I don't understand what controls are included.  If the user clicks "Edit" on this row and it brings up the update and cancel buttons, how does that affect the count of the controls.  I have this same code in the footer row and it works fine, not the case in the actual grid.

Thanks in advance,

N
ASKER CERTIFIED SOLUTION
Avatar of SQL_SERVER_DBA
SQL_SERVER_DBA
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of stretch73

ASKER

I'm adding a javascript to the control like this:

txtM1Amt.Attributes.Add("onkeypress", "return isNumberKey(event);")

It has more to do with making sure I get the correct control than the data inside of it