Hi,
I am trying to create user control which has radgrid and sqldatasource controls. I added radgrid to a a new ascx as given below:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl.ascx.cs"
Inherits="Controls_WebUserControl" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<telerik:RadGrid AutoGenerateColumns="False" ID="RadGrid1" DataSourceID="SqlDS" AllowFilteringByColumn="true"
AllowPaging="True" AllowSorting="True" runat="server" OnPageIndexChanged="RadGrid1_PageIndexChanged" Skin="Office2007" PageSize="10" EnableViewState="true">
<PagerStyle Mode="NextPrevNumericAndAdvanced" />
<MasterTableView>
<PagerStyle Mode="NextPrevNumericAndAdvanced" />
<Columns>
<telerik:GridBoundColumn DataField="RollNo" SortExpression="RollNo" HeaderButtonType="TextButton" ShowSortIcon="true"
AutoPostBackOnFilter="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="StudentName" SortExpression="StudentName" HeaderButtonType="TextButton"
ShowSortIcon="true">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Address" SortExpression="Address" HeaderButtonType="TextButton" ShowSortIcon="true">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
<asp:SqlDataSource ID="SqlDS" ConnectionString="<%$ ConnectionStrings:cemiConnectionString %>"
ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM Student" runat="server" />
When I am changing pages using 1,2,3, it is working fine. But, when I click on pager images like next,previous,first, last is generating the following error:
Exception Details: System.ArgumentException: 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.
Source Error:
If the move the raggrid and sqldatasource to a new web page(default.aspx), everything is working fine.
Can I know the issue why it is generating error when I am adding it to user control???
Thanks,
Mahesh
I am trying to create user control which has radgrid and sqldatasource controls. I added radgrid to a a new ascx as given below:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl.ascx.cs"
Inherits="Controls_WebUserControl" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<telerik:RadGrid AutoGenerateColumns="False" ID="RadGrid1" DataSourceID="SqlDS" AllowFilteringByColumn="true"
AllowPaging="True" AllowSorting="True" runat="server" OnPageIndexChanged="RadGrid1_PageIndexChanged" Skin="Office2007" PageSize="10" EnableViewState="true">
<PagerStyle Mode="NextPrevNumericAndAdvanced" />
<MasterTableView>
<PagerStyle Mode="NextPrevNumericAndAdvanced" />
<Columns>
<telerik:GridBoundColumn DataField="RollNo" SortExpression="RollNo" HeaderButtonType="TextButton" ShowSortIcon="true"
AutoPostBackOnFilter="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="StudentName" SortExpression="StudentName" HeaderButtonType="TextButton"
ShowSortIcon="true">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Address" SortExpression="Address" HeaderButtonType="TextButton" ShowSortIcon="true">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
<asp:SqlDataSource ID="SqlDS" ConnectionString="<%$ ConnectionStrings:cemiConnectionString %>"
ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM Student" runat="server" />
When I am changing pages using 1,2,3, it is working fine. But, when I click on pager images like next,previous,first, last is generating 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.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.ArgumentException: 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.
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below. |
If the move the raggrid and sqldatasource to a new web page(default.aspx), everything is working fine.
Can I know the issue why it is generating error when I am adding it to user control???
Thanks,
Mahesh