Hi,
I'm having a problem with edit button in the RadGrid. Everything works fine when I use a ButtonType of linkButton, but when I switch the Button type to ImageButton, I get the following error.
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 don't understand why everything works fine with a linkbutton but not with an imagebutton. Does some different event get fired with an ImageButton?
The aspx code is as follows:
And the code behind is
Any ideas?
Thanks,
Tom
I'm having a problem with edit button in the RadGrid. Everything works fine when I use a ButtonType of linkButton, but when I switch the Button type to ImageButton, I get the following error.
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 don't understand why everything works fine with a linkbutton but not with an imagebutton. Does some different event get fired with an ImageButton?
The aspx code is as follows:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="gridTest.aspx.cs" Inherits="<...our path here...>Presentation.Web.UI.InventoryManagement.gridTest" %> |
<%@ Register Assembly="RadGrid.Net2" Namespace="Telerik.WebControls" TagPrefix="rad" %> |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
<html xmlns="http://www.w3.org/1999/xhtml" > |
<head runat="server"> |
<title>Untitled Page</title> |
</head> |
<body> |
<form id="form1" runat="server"> |
<div> |
<rad:RadGrid ID="RadGrid1" runat="server" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" |
AutoGenerateColumns="False" |
EnableAJAX="True" GridLines="None" Skin="Outlook2007"> |
<ClientSettings> |
<Selecting AllowRowSelect="True" /> |
</ClientSettings> |
<MasterTableView DataKeyNames="StaustOutcomeId" CommandItemDisplay="Bottom" EditMode="InPlace" > |
<Columns> |
<rad:GridButtonColumn CommandName="Edit" UniqueName="Edit" Text="Edit" ButtonType="ImageButton" |
HeaderText="Edit"> |
</rad:GridButtonColumn> |
<rad:GridBoundColumn DataField="Outcome" HeaderText="Outcome" SortExpression="Outcome" |
UniqueName="Outcome"> |
</rad:GridBoundColumn> |
<rad:GridBoundColumn DataField="Status" HeaderText="Status" SortExpression="Status" |
UniqueName="Status"> |
</rad:GridBoundColumn> |
<rad:GridBoundColumn DataField="Description" HeaderText="Description" SortExpression="Description" |
UniqueName="Description"> |
</rad:GridBoundColumn> |
<rad:GridCheckBoxColumn DataField="IsActive" DataType="System.Boolean" HeaderText="IsActive" |
SortExpression="IsActive" UniqueName="IsActive"> |
</rad:GridCheckBoxColumn> |
<rad:GridBoundColumn DataField="SalesChannel" HeaderText="SalesChannel" SortExpression="SalesChannel" |
UniqueName="SalesChannel"> |
</rad:GridBoundColumn> |
<rad:GridBoundColumn DataField="StaustOutcomeId" DataType="System.Int32" HeaderText="StaustOutcomeId" |
ReadOnly="True" SortExpression="StaustOutcomeId" UniqueName="StaustOutcomeId"> |
</rad:GridBoundColumn> |
</Columns> |
<ExpandCollapseColumn Resizable="False" Visible="False"> |
<HeaderStyle Width="20px" /> |
</ExpandCollapseColumn> |
<RowIndicatorColumn Visible="False"> |
<HeaderStyle Width="20px" /> |
</RowIndicatorColumn> |
</MasterTableView> |
</rad:RadGrid> |
</div> |
</form> |
</body> |
</html> |
And the code behind is
using System; |
using System.Data; |
using System.Configuration; |
using System.Collections; |
using System.Web; |
using System.Web.Security; |
using System.Web.UI; |
using System.Web.UI.WebControls; |
using System.Web.UI.WebControls.WebParts; |
using System.Web.UI.HtmlControls; |
using System.Collections.Generic; |
namespace <...our path here...>.Presentation.Web.UI.InventoryManagement |
{ |
public partial class gridTest : System.Web.UI.Page |
{ |
protected void Page_Load(object sender, EventArgs e) |
{ |
List<StatusOtcm> lst = new List<StatusOtcm>(3); |
for (int i=0; i<3; i++) |
lst.Add(new StatusOtcm()); |
RadGrid1.DataSource = lst; |
RadGrid1.DataBind(); |
} |
} |
class StatusOtcm |
{ |
public string Description |
{ |
get { return "some Description"; } |
} |
public string Outcome |
{ |
get { return "OC"; } |
} |
public string Status |
{ |
get { return "Complete"; } |
} |
public bool IsActive |
{ |
get { return true; } |
} |
public string SalesChannel |
{ |
get { return "P"; } |
} |
public int StaustOutcomeId |
{ |
get { return 25;} |
} |
} |
} |
Any ideas?
Thanks,
Tom