D
den 2005
Hi everybody,
I am not familiar using Gridview, I created a Gridview with Edit Command
Button, but when I click the update Command button this error message below
is displayed, what and where is the problem? I am confused. Can anyone show
me exactly to do edit process of Gridview using Edit Command button properly?
Thanks.
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.
I am not familiar using Gridview, I created a Gridview with Edit Command
Button, but when I click the update Command button this error message below
is displayed, what and where is the problem? I am confused. Can anyone show
me exactly to do edit process of Gridview using Edit Command button properly?
Thanks.
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.
Code:
protected void gdvLinks_RowEditing(object sender, GridViewEditEventArgs e)
{
gdvLinks.EditIndex = e.NewEditIndex;
for (int x = 0; x < gdvLinks.Columns.Count; x++)
{
gdvLinks.Columns[x].Visible = true;
}
gdvLinks.DataSource = dtLinks;
gdvLinks.DataBind();
}
protected void gdvLinks_RowUpdating(object sender,
GridViewUpdateEventArgs e)
{
gdvLinks.EditIndex = -1;
LoadLinkGrid();
}
//Loading datasource not using SqlDatasource control
private void LoadLinkGrid()
{
gdvLinks.DataSource = dtLinks;
gdvLinks.DataBind();
}