Click here to Skip to main content
15,923,689 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This is my code

C#
protected void newgrid_edit(GridViewEditEventArgs e, object sender)
       {
           hitechLatestEntities database = new hitechLatestEntities();
           ((GridView)sender).EditIndex = e.NewEditIndex;

           ((GridView)sender).DataSource = database.SUB_HEAD;
           ((GridView)sender).DataBind();

       }


SUB_HEAD table has two attributes naming sub_head_code and particulars. when e.NewEditIndex is executed, row changes to textboxes. i want to give IDs to those textboxes for fetching in update event. Please keep in mind, i am doing noting in aspx file. Everything is in code behind.
Posted
Updated 29-Jan-14 13:36pm
v2

1 solution

C#
protected void newgrid_edit(GridViewEditEventArgs e, object sender) 
{
     GridViewRow selectRow = grd.Rows(e.NewEditIndex);
     TextBox txtSomeId=(TextBox)selectRow.Cells[3].FindControl("txtSome"); 
}


txtSomeId is the Id here.
 
Share this answer
 
Comments
Basit Elahi 30-Jan-14 7:19am    
thanks prasadavunuri. i took idea from this and have solved my problem.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900