I used the Editable GridView All-in-one code as a starting point and it is working like a charm. I have actually modified it to allow for double click row event and other visual asthetics. However, I am not sure why I am receiving a Postback error when I perform the DoubleClick on the row. If I set EnableEventValidation to False, the error goes away. Since this opens us up to possible injection attacks, I want to leave it as True.
I added the following column and programmatically set visible to False.
<asp:buttonfield text="DoubleClick" commandname="DoubleClick" xmlns:asp="#unknown" />
I added the following code to the bottom of GridView1_RowDataBound event handler:
LinkButton _doubleClickButton = (LinkButton)e.Row.Cells[1].Controls[0];
string _jsDouble =
ClientScript.GetPostBackClientHyperlink(_doubleClickButton, "");
e.Row.Attributes["ondblclick"] = _jsDouble;
_doubleClickButton.Visible = false;
Then I added the following Render event:
protected override void Render(HtmlTextWriter writer)
{
foreach (GridViewRow row in GridView1.Rows)
{
if (row.RowType == DataControlRowType.DataRow)
{
Page.ClientScript.RegisterForEventValidation(row.UniqueID + "$ctl0");
}
}
base.Render(writer);
}
I have been online checking posts for hours and trying various examples but I can't seem to figure out why I receive the following error message:
Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
If anyone could help, that would be great! I am not a novice programmer but I am a newbie to ASP.Net. Any help would be appreciated.
Kristin