Home » Asp.net

find textbox control of gridview using javascript


 I am inserting a data in gridview row. I have 2 textbox's, 1 label and 1 textbox respectively. Here, I want to do calculations on data which is in first two textboxes and result should be displayed in label and the text in label to be multiplied with 40 and that should be displayed in last textbox.

 This operation to be done in onblur() event of second textbox. To do this I need to find the controls in gridview in onblur() event of the textbox.

  I tried to do this in .cs file but this operation is to be done before inserting in to database on that particular row of gridview.

I searched on the net but i couldn't find the solution. I couldn't know how to find textbox of a gridview using javascript

Please help me.....


1 Answer Found


Answer 1



  first u get ur gridview in a variable like this

var Grid =document.getElementById(GetClientId('YourGridControlID'));


then u can acess any row and cell and there children which is ur textbox and label like that

Grid.rows[RowindexStartForm 1].Cells[CellindexStartFrom 0].Children[0].value;



<< Previous      Next >>

Microsoft   |   Windows   |   Visual Studio   |   Sharepoint   |   Azure