// Client End
………………………………..
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always">
<ContentTemplate>
<ej:Grid ID="mainGrid" ……………..>
……………………………………
<ClientSideEvents DataBound="mainGridDataBound" />
……………….
<Columns>
……………………………..
</Columns>
</ej:Grid>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
<div class="col-lg-3 bg-transparent">
<div id="UsersContainer" style="height: 100%; width: 100%">
<asp:UpdatePanel ID="UpdatePanel4" runat="server" UpdateMode="Always">
<ContentTemplate>
<ej:Grid ID="userNumberGrid" ………….>
……………………
<ClientSideEvents DataBound="userNumberGridDataBound" />
…………………….
<Columns>
……………………
</Columns>
</ej:Grid>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
<div class="col-lg-3 bg-transparent">
<div id="freeGridContainer" style="height: 100%; width: 100%">
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Always">
<ContentTemplate>
<ej:Grid ID="freeNumberGrid" ………..>
……………………………………………………………..
<Columns>
…………………………………
</Columns>
</ej:Grid>
<script>
var flag1, flag2 = false;
function mainGridDataBound() {
flag1 = true;
if (flag1 && flag2)
webmethod();
}
function userNumberGridDataBound() {
flag2 = true;
if (flag1 && flag2)
webmethod();
}
function webmethod() {
$.ajax(
{
type: "POST",
contentType: 'application/json; charset=utf-8',
url: 'Default.aspx/freeNumberGridData',
dataType: 'json',
success: function (data) { // get the data from here.
var gridobj = $("#<%= freeNumberGrid.ClientID %>").ejGrid("instance"); // take the grid instance using grid id.
gridobj.dataSource(data.d); // update the dataSource for third grid using dataSource method of ejGrid.
},
});
}
</script>
</ContentTemplate>
</asp:UpdatePanel>
// CodeBehind
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public static object freeNumberGridData()
{
// do your stuff and return the data
return data;
} |