In the row Data Bound event of the grid User has to find the Update control which will normally be in the first cell of the every grid row.Then after finding the control user has to add the attributes to the link button of the grid row.
if (e.Row.Cells[0].HasControls())
{
for (int i = 0; i < e.Row.Cells[0].Controls.Count; i++)
{
if (e.Row.Cells[0].Controls[i].ToString() == "System.Web.UI.WebControls.DataControlLinkButton")
{
LinkButton lnkbtnUpdate = (LinkButton)e.Row.Cells[0].Controls[i];
if (lnkbtnUpdate.Text.ToUpper() == "UPDATE")
{
lnkbtnUpdate.Attributes.Add("onclick", "return onUpdateValidation('" + e.Row.FindControl("txtName").ClientID + "');");
break;
}
if (lnkbtnUpdate.Text.ToUpper() == "EDIT")
{
break;
}
}
}
}
Monday, November 10, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment