i have a gridview.
there is a itemtemplet a TEXTBOX txt_name
i want to fetch this textbox text using javascript.
how can i do this.
how can i call that textbox of gridview using javascript
Fetching data from gridview textbox using javascript
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Dorababu MekaRank #457 · 5.5K reputationPosted Feb 3, 2012, 8:26 PM EST
txt.attributes.add("function(ex:onclick")","your JS function");
I am not sure about this but make a try
Dorababu MekaRank #457 · 5.5K reputationPosted Feb 3, 2012, 8:45 PM EST
protected void gvDetails_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
TextBox txt = (TextBox)e.Row.FindControl("txt");
txt.Attributes.Add("onclick", "f1()");
}
}
I just write a simple javascript to alert hello in that f1()
alternative you can pass the control to function if needed