Dynamic Item tmpate inside gridview
-
Hi, I am creating item template dynamically inside gridview in Asp.net 2.0. The Item templates are sucessfully created.like as follows, Assume below as a grid view Rows & Columns : EmpID EmpName Basic HRA MA TA PF OTHER ------------------------------------------------------------- 1 Employe1 10000 1000 500 400 300 700 2 Employe2 20000 2000 800 600 400 800 3 Employe3 30000 2500 900 700 400 900 ------------------------------------------------------------- so the above coloumns as item template created dynamically First 2 column are labels and rest of the columns are textbox...So the first time loading the gridview with 3 rows empty - then i will enter data then i will save it to database... so UPTO here working fine... Note: The problem is i can change the text vaue from any rows any coloumn, i want find which rows and which cell was changed ,, how to find this..plz tell me ... i ll give code snippet, Gridview_RowCreatedEvent() If e.Row.RowType = DataControlRowType.DataRow The Dim txt As New TextBox For inti = 0 To 7 strname = "txt" & inti txt = CType(e.Row.FindControl(strname), TextBox) AddHandler txt.TextChanged, AddressOf txt_TextChanged Next End If Regards, Sekannak....
kannak
-
Hi, I am creating item template dynamically inside gridview in Asp.net 2.0. The Item templates are sucessfully created.like as follows, Assume below as a grid view Rows & Columns : EmpID EmpName Basic HRA MA TA PF OTHER ------------------------------------------------------------- 1 Employe1 10000 1000 500 400 300 700 2 Employe2 20000 2000 800 600 400 800 3 Employe3 30000 2500 900 700 400 900 ------------------------------------------------------------- so the above coloumns as item template created dynamically First 2 column are labels and rest of the columns are textbox...So the first time loading the gridview with 3 rows empty - then i will enter data then i will save it to database... so UPTO here working fine... Note: The problem is i can change the text vaue from any rows any coloumn, i want find which rows and which cell was changed ,, how to find this..plz tell me ... i ll give code snippet, Gridview_RowCreatedEvent() If e.Row.RowType = DataControlRowType.DataRow The Dim txt As New TextBox For inti = 0 To 7 strname = "txt" & inti txt = CType(e.Row.FindControl(strname), TextBox) AddHandler txt.TextChanged, AddressOf txt_TextChanged Next End If Regards, Sekannak....
kannak
You can set the id of the control to contain a row index, then in your text changed event, check the id of the control that fired it. You can also use it's Tag property.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Hi, I am creating item template dynamically inside gridview in Asp.net 2.0. The Item templates are sucessfully created.like as follows, Assume below as a grid view Rows & Columns : EmpID EmpName Basic HRA MA TA PF OTHER ------------------------------------------------------------- 1 Employe1 10000 1000 500 400 300 700 2 Employe2 20000 2000 800 600 400 800 3 Employe3 30000 2500 900 700 400 900 ------------------------------------------------------------- so the above coloumns as item template created dynamically First 2 column are labels and rest of the columns are textbox...So the first time loading the gridview with 3 rows empty - then i will enter data then i will save it to database... so UPTO here working fine... Note: The problem is i can change the text vaue from any rows any coloumn, i want find which rows and which cell was changed ,, how to find this..plz tell me ... i ll give code snippet, Gridview_RowCreatedEvent() If e.Row.RowType = DataControlRowType.DataRow The Dim txt As New TextBox For inti = 0 To 7 strname = "txt" & inti txt = CType(e.Row.FindControl(strname), TextBox) AddHandler txt.TextChanged, AddressOf txt_TextChanged Next End If Regards, Sekannak....
kannak
You can use the text changed event of the textbox.If u want that particular row just try this,
GridviewRow gvRow = (sender as TextBox).NamingContainer
Arun Jacob http://codepronet.blogspot.com/