// the datasource "window.ordersView" is referred from jsondata.min.js var data = ej.DataManager(window.ordersView).executeLocal(ej.Query().where("EmployeeID", "equal", parseInt(filteredData), true));But I don't know how get my details executing a store procedure
<ej:Grid ID="EmployeesGrid" runat="server" DetailsTemplate="#tabGridContents"> <ClientSideEvents DetailsDataBound="detailGridData" /> <Columns> <ej:Column Field="EmployeeID" HeaderText="Employee ID" IsPrimaryKey="True" TextAlign="Right" Width="75" /> <ej:Column Field="FirstName" HeaderText="First Name" Width="100" /> <ej:Column Field="Title" HeaderText="Title" Width="120" /> <ej:Column Field="City" HeaderText="City" Width="100" /> <ej:Column Field="Country" HeaderText="Country" Width="100" /> </Columns> <script id="tabGridContents" type="text/x-jsrender"> <div class="tabcontrol"> <div id="detailGrid"></div> </div> |
function detailGridData(e) {
if (!window.ordersData) { // get data using the ajax $.ajax({ url: "/Default.aspx/Data", type: "POST", dataType: "json", contentType: 'application/json; charset=utf-8', success: function (result) { window.ordersData = result.d; bindData(e, window.ordersData); }, error: function (xhr) { alert('error'); } }) } else bindData(e, window.ordersData); [WebMethod] [ScriptMethod(ResponseFormat = ResponseFormat.Json)] public static object Data() { // use your code here DataTable t = new DataTable(); using (SqlConnection c = new SqlConnection()) { string cons = ConfigurationManager.ConnectionStrings["NORTHWNDConnectionString"].ConnectionString; c.ConnectionString = cons; c.Open(); using (SqlDataAdapter a = new SqlDataAdapter("SELECT top 50 * FROM [Orders]", c)) { a.Fill(t); } }
. . . .
return order; |
//EmployeeID field name same as the parent and details grid
function bindData(e, data) { var filteredData = e.data["EmployeeID"];
var data = ej.DataManager(data).executeLocal(ej.Query().where("EmployeeID", "equal", parseInt(filteredData), true));
e.detailsElement.find("#detailGrid").ejGrid({
. . .
}); |
Hi Manolo,
We are happy that the provided information helped you.
We have considered your suggestion as an improvement and it will be refresh in online any of our upcoming release.
Regards,
Balaji Marimuthu