<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
<ej:button id="ButtonNormal" type="Button" runat="server" clientsideonclick="btnClick" text="Button"></ej:button>
<ej:grid id="EmployeesGrid" runat="server" width="1500px" allowpaging="true">
<!--DataSource is Empty at intial Render-->
<Columns>
<ej:Column Field="OrderID" IsPrimaryKey="true" HeaderText="Order ID" Width="80" />
. . . .
</Columns>
</ej:grid>
<script>
function btnClick(e) {
$("#MainContent_EmployeesGrid").ejGrid({ dataSource: ej.DataManager({ url: "Default.aspx/Data", adaptor: new ej.WebMethodAdaptor() }) })
}
</script>
</asp:Content>
[Code Behind]
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public static object Data(Syncfusion.JavaScript.DataManager value)
{
IEnumerable Data = OrderRepository.GetAllRecords();
int count = Data.AsQueryable().Count();
return new { result = Data, count = count };
}
|