We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to send custom parameters to events

Platform: ASP.NET Web Forms |
Control: General |
Published Date: July 14, 2017 |
Last Revised Date: May 8, 2019

This knowledge base explains the way to send custom parameter to events. You can just send the parameter as option to the widget on its creation and access it in the widget instance.

In general, any properties sent to the widget on its creation is accessible later via widget’s model property.

For other wrappers, also, we have come up with the same approach by setting up the parameter in the widget’s model and later retrieving from it.

JavaScript Solution

 

[JS]

<script>
    $(function () {
        $("#Spreadsheet").ejSpreadsheet({
            customParameter: { cellSave: { foo: "bar" }, cellClick: { baz: "qux" } }, //dummy params
            cellSave: "cellSave",
            cellClick: "cellClick"
        });
    });
    function cellSave(args) {
        var parameter = this.model.customParameter.cellSave;
    }
    function cellClick(args) {
        var parameter = this.model.customParameter.cellClick;
    }
</script>

 

MVC Solution

 

[CSHTML]

 

    @(Html.EJ().Spreadsheet<ItemDetail>("Spreadsheet").ClientSideEvents(events => events.LoadComplete("loadComplete").CellSave("cellSave").CellClick("cellClick"))
    )
 
<script type="text/javascript">
    function loadComplete(args) {
        this.option(customParameter, { cellSave: { foo: "bar" }, cellClick: { baz: "qux" } }); //dummy params
    }
    function cellSave(args) {
        var parameter = this.model.customParameter.cellSave;
    }
    function cellClick(args) {
        var parameter = this.model.customParameter.cellClick;
    }
</script>

 

ASP Solution

 

[ASPX]

<ej:Spreadsheet ID="FlatSpreadsheet" runat="server">
    <ClientSideEvents LoadComplete="loadComplete" CellSave="cellSave" CellClick="cellClick"/>
</ej:Spreadsheet>
 
<script type="text/javascript">
    function loadComplete(args) {
        this.option(customParameter, { cellSave: { foo: "bar" }, cellClick: { baz: "qux" } }); //dummy params
    }
    function cellSave(args) {
        var parameter = this.model.customParameter.cellSave;
    }
    function cellClick(args) {
        var parameter = this.model.customParameter.cellClick;
    }
</script>

 

2X faster development

The ultimate ASP.NET Web Forms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon