<ClientSideEvents ContextClick="contextClick" /> <ContextMenuSettings EnableContextMenu="true"DisableDefaultItems="true"> <CustomContextMenuItem> <ej:CustomContexMenuItems Id="clear" Text="Button 1" /> </CustomContextMenuItem> </ContextMenuSettings> |
<script type="text/javascript"> function contextClick(args) { if (args.text == "Button 1") { var obj = $(".e-grid").ejGrid("instance"); var data = obj.getSelectedRecords(); $.ajax({ type: "POST", url: "/Grid/GridFeatures.aspx/Data", datatype: "json", contentType: "application/json; charset=utf-8", data: JSON.stringify({ gid: JSON.stringify(data) }), success: function (result) { } }); } } </script> |
[WebMethod] [ScriptMethod(ResponseFormat = ResponseFormat.Json)] public static string Data(string gid) { return gid; } |
|
Hi Thavasianand,
Thanks for your reply. But, I didn't get my answer. My goal is clicking "Button 1" and make Panel1.visible = true. I want to do actions with syncfusion grid's custom context menu items. This is an example of my request.
Regards
<div id="ControlRegion"> <div class="frame "> <div> <ej:Grid ID="Grid1" AllowSorting="true" AllowPaging="True" Locale="en-US" runat="server"> <ClientSideEvents ContextClick="contextClick" /> <ContextMenuSettings EnableContextMenu="true" DisableDefaultItems="true"> <CustomContextMenuItem> <ej:CustomContexMenuItems Id="clear" Text="Button 1" /> </CustomContextMenuItem> </ContextMenuSettings> <Columns> <ej:Column Field="OrderID" HeaderText="Order ID" IsPrimaryKey="true" TextAlign="Right" Width="90" /> <ej:Column Field="CustomerID" HeaderText="Customer ID" Width="100" /> <ej:Column Field="EmployeeID" HeaderText="Employee ID" TextAlign="Right" Width="110" /> <ej:Column Field="Freight" HeaderText="Freight" TextAlign="Right" Width="90" Format="{0:C}" /> <ej:Column Field="OrderDate" HeaderText="Order Date" Width="100" TextAlign="Right" Format="{0:MM/dd/yyyy}" /> <ej:Column Field="ShipCity" HeaderText="Ship City" Width="100" /> </Columns> </ej:Grid> </div> </div> <asp:Panel ID="Panel1" Visible="false" runat="server"> <asp:Button ID="Button1" runat="server" Text="Button" /> </asp:Panel> </div> ------------------------------------------------------------ public void HelloWorld() { Panel1.visible = true; } |
<script type="text/javascript"> function contextClick(args) { if (args.text == "Button 1") { __doPostBack('btnNew', args.text) } } </script> ------------------------------------------ protected void Page_Load(object sender, EventArgs e) { string parameter = Request["__EVENTARGUMENT"]; if (parameter == "Button 1") this.Panel1.Visible = true; BindDataSource(); } |