How to retrive a Control in a specific ROW in edit mode in a GridView

jacobsjungle

New Member
I have a GridView with many rows.When a User click the EDIT button in GridView I need to retrieve a Control in that specific row (now in edit mode).This Logic should work on GridEvent \[code\]_RowUpdating\[/code\]At the moment my code (wrong) look inside every Row, so the Control founded is not unique and I receive an error.\[code\]// Event handler protected void uxManageSponsoredContentsDisplayer_RowUpdating(object sender, GridViewUpdateEventArgs e)\[/code\]\[code\]// My code (Wrong!!!!):foreach (GridViewRow row in uxManageSponsoredContentsDisplayer.Rows) { TextBox uxStartDate = (TextBox)row.FindControl("uxEffectiveStartDateInput"); }\[/code\]Hope my question is clear. Any idea how to do it? ThanksSolution:\[code\] TextBox uxStartDate = (TextBox)uxManageSponsoredContentsDisplayer.Rows[e.RowIndex].FindControl("uxEffectiveStartDateInput");\[/code\]
 
Back
Top