Add Java Script Function to gridview cells in Asp.net

Category: ASP.NETC#.NetJAVA SCRIPT Comments: No comments

//Add java script function on cells with value
protected void GridUsers_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Cells[1].Attributes.Add(“onClick”, “JavaScript: GetOrderDetail(‘” + Convert.ToInt32(GridUsers.DataKeys[e.Row.RowIndex].Value.ToString()) + “‘)”);

}
}

Leave a Reply

Your email address will not be published. Required fields are marked *

*

HTML tags are not allowed.