Click here to Skip to main content
16,020,669 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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:
// Get the LinkButton control in the second cell
LinkButton _doubleClickButton = (LinkButton)e.Row.Cells[1].Controls[0];
// Get the javascript which is assigned to this LinkButton
string _jsDouble = 
ClientScript.GetPostBackClientHyperlink(_doubleClickButton, "");
// Add this javascript to the ondblclick Attribute of the row
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)
{
// validate the controls event
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
Posted
Updated 29-Jun-10 4:00am
v6

1 solution

EnablePageValidation=true, this property means when submitting a form from browser to server,it should accept the html tags from the browser.
 
Share this answer
 
Comments
KHolum 30-Jun-10 9:13am    
Thank you for your response but that is not the answer to my question. I understand what EnableEventValidation means. I need to know what I am doing wrong and how to fix it or what exactly to look for.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900