0

I have a telerik grid in my index.cshtml and i created a custom Edit Command in my Grid. I want that whenever i click on edit i want to pass every column value to a PopUp window i created and assign those values to text boxes inside PopUp Window.

My Grid looks like as follows

@(Html.Telerik().Grid<POModel>().Name("PurchaseOrders")

     .DataKeys(keys => keys.Add(o => o.WorkOrderPaymentID))
    .Columns(columns =>
                {
                    columns.Bound(o => o.SuppliersInvoiceNumber).HeaderTemplate("<div>Invoice Number</div>") ;
                    columns.Bound(o => o.PONumber).HeaderTemplate("<div>PO Number</div>").ReadOnly().Width(215);
                    columns.Bound(o => o.VendorName).HeaderTemplate("<div>Vendor Name</div>").ReadOnly();

                    columns.Bound(o => o.AmountPaidToSupplier).HeaderTemplate("<div>Total PO Amount</div>").Format("{0:c}").ReadOnly();


                    columns.Command(commands => commands
                 .Custom("Edit")
                 .Text("Edit")
                 .SendState(false)
                 .DataRouteValues(route =>
                 {
                     route.Add(o => o.SuppliersInvoiceNumber).RouteKey("InvoiceNumber");
                     route.Add(o => o.PONumber).RouteKey("PONumber");
                     route.Add(o => o.VendorName).RouteKey("VendorName");
                     route.Add(o => o.AmountPaidToSupplier).RouteKey("AmountPaid");
                 })
                   .Ajax(true)

                 .Action("editPOList", "PurchaseOrder", new { invoiceID = Model.selectedInvoiceID }));



                })




       .DataBinding(dataBinding => dataBinding.Ajax().Select("getPOList", "PurchaseOrder", new { invoiceID = Model.selectedInvoiceID }))

    .Scrollable()
    .Editable(editing => editing.Enabled(true))


  .Sortable() )

What my Grid Action for Edit should look like if i want to pass all the column values to PopUp Window??

Francis P
  • 13,377
  • 3
  • 27
  • 51
Fahad Abid Janjua
  • 1,024
  • 3
  • 14
  • 35

1 Answers1

0

Most probably the default MVC Model Binder will successfully extract the Route values so you can add POModel argument to your action method signature.

public ActionResult editPOList(POModel model)
        {
            //...
        }
Petur Subev
  • 19,983
  • 3
  • 52
  • 68