here I need to pass the value of textbox to javascript
gridview with textbox template field
Add a client side onkeyup to each textbox in a
RowDataBound
method where each row is called. Find the textbox using FindControl and then add onclick attribute referring a JS method.
In JS method, get the textbox value and then apply your logic.
Something like:
protected void GridView_RowDataBound(Object sender, GridViewRowEventArgs e)
{
TextBox tb = (TextBox)e.Row.FindControl("TextBox1");
tb.Attributes.Add("onkeyup", "javascript: ValidateMe(this);");
}
function ValidateMe(currtextbox)
{
}