How to referencing value from Textbox in the GridEvents

3 posts, 0 answers
  1. Neer
    Neer avatar
    3 posts
    Member since:
    Aug 2011

    Posted 09 Sep 2014 Link to this post

    Hi,

    When running the Create, Read, Update, Destroy events. I want to pass in the value of  $("MasterAccountID") to the controller. I can't figure out how to do with, without writing the JavaScript manually.

    <input type="textbox" name="MasterAccountID"  id="MasterAccountID" />
    @(Html.Kendo().Grid<Ownership>() // Specify the type of the grid
                    .Name("Ownership")
                    .Columns(columns =>
                    {
                        columns.Bound(o => o.AccountName);
                        columns.Bound(o => o.AccountNumber);
                        columns.Bound(o => o.Percent);
                        columns.Bound(o => o.Status);
                        columns.Command(command => { command.Edit(); command.Destroy(); }).Width(200);
                    })
     
                    .DataSource(dataSource => dataSource
                        .Ajax()
                        .ServerOperation(true)
                        .PageSize(20)
                        .Model(model =>
                        {
                            model.Id(o => o.AccountNumber);
                        })
     
                        .Read(read => read.Action("Ownership_Read", "Owner", [PASS TEXTBOX VALUE]))
                    )
            )
  2. Neer
    Neer avatar
    3 posts
    Member since:
    Aug 2011

    Posted 10 Sep 2014 Link to this post

    Figured it out.

    .Update(update => update
    .Action("Action", "Controller")
                              .Data("additionalData")
    )
  3. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2310 posts

    Posted 11 Sep 2014 Link to this post

    Hello Neer,


    Indeed this is the correct approach to send additional data with the request.

    Do not hesitate to contact us again if further issues arise.

    Regards,
    Dimiter Madjarov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top