Trying to call Create action on Grid using JQuery (MVC)

2 posts, 0 answers
  1. Paul
    Paul avatar
    13 posts
    Member since:
    Sep 2015

    Posted 03 Nov 2015 Link to this post

    I am trying to use a JQuery command to call the ​Create action on a grid.  Reason for this is that i need to pass an external id to the create command that is currently stored in a hidden HTML input field.

    Here is the code

    <input type="hidden" id="acctid" value="">
        function insertnotes(e) {
            var accId = document.getElementById("acctid").value;
            $("#Child").data("kendoGrid").dataSource.create({ accountId: accId });

            //$("#Child").data("kendoGrid"){ accountId: accId });​

    .Create(create => create.Action("Account_Master_Notes_Create", "AccountMaster"))
    Action in Controller
    public ActionResult Account_Master_Notes_Create(string acctid,
    [DataSourceRequest]DataSourceRequest request, Account_Note_Master account_Notes_Master)

    The alert in the script is telling me that acctid is populated... i just want to call the create action.... the error i am getting is that dataSource.create is not a function


    Thanks for any help on this issue.



  2. Dimiter Madjarov
    Dimiter Madjarov avatar
    2288 posts

    Posted 04 Nov 2015 Link to this post

    Hello Corey,

    You could use the .Data() method to specify a JavaScript function that will pass additional data to the create action and retrieve the input value in this function.

    .Create(update => update.Action("Create", "Grid").Data("additionalData"))

    function additionalData() {
        return {
            firstName: "John",
            lastName: "Doe"

    Dimiter Madjarov
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top