// Client-Side
<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
<ej:Grid ID="Grid" runat="server" AllowPaging="True" AllowSorting="true" OnServerRecordClick="Grid_ServerRecordClick">
<EditSettings AllowEditing="True" AllowAdding="True" AllowDeleting="True"></EditSettings>
<ToolbarSettings ShowToolbar="True" ToolbarItems="add,edit,delete,update,cancel"></ToolbarSettings>
<ClientSideEvents RecordClick="recordclick" />
<Columns>
---------------------------------------------------
</Columns>
</ej:Grid>
<script>
function recordclick(args) {
var rowdata = args.data;
}
</script>
</asp:Content>
|
<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
<ej:Grid ID="Grid" runat="server" AllowPaging="True" AllowSorting="true" OnServerRecordClick="Grid_ServerRecordClick">
<EditSettings AllowEditing="True" AllowAdding="True" AllowDeleting="True"></EditSettings>
<ToolbarSettings ShowToolbar="True" ToolbarItems="add,edit,delete,update,cancel"></ToolbarSettings>
<ClientSideEvents RecordClick="recordclick" />
<Columns>
---------------------------------------
</Columns>
</ej:Grid>
</asp:Content>
---------------------------------------------------
protected void Grid_ServerRecordClick(object sender, GridEventArgs e)
{
Orders value = new Orders();
List<Orders> data = ViewState["DataSource"] as List<Orders>;
Dictionary<string, object> KeyVal = e.Arguments["data"] as Dictionary<string, object>;
foreach (KeyValuePair<string, object> keyval in KeyVal)
{
if (keyval.Key == "OrderID")
value.OrderID = Convert.ToInt32(keyval.Value);
else if (keyval.Key == "CustomerID")
value.CustomerID = Convert.ToString(keyval.Value);
else if (keyval.Key == "EmployeeID")
value.EmployeeID = Convert.ToInt32(keyval.Value);
else if (keyval.Key == "Freight")
value.Freight = Convert.ToDouble(keyval.Value);
else if (keyval.Key == "ShipCity")
value.ShipCity = Convert.ToString(keyval.Value);
}
}
} |