This is a migrated thread and some comments may be shown as answers.

[Solved] Ajax MVC Grid Loaded in Partial View

0 Answers 11 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Byron
Top achievements
Rank 1
Byron asked on 05 Mar 2013, 09:04 PM
Hi.  I am trying to load an MVC grid using Ajax binding.  The grid is defined in a partial view:

In the view:

<div id="columnMapping">
@if (Model != null)
{
     @RenderPage("~/Views/FeeSrcFlatRate/Partials/_ColumnMapping.cshtml", Model)
}
</div>

Here's the grid definition in the partial view _ColumnMapping.cshtml:

@(Html.Telerik().Grid(Model.TextFileImportData)
            .Name("FeeSourceFlatDetailGrid")
            .Columns(columns =>
            {
                columns.Bound(m => m.CPT_CDE).Title("CPT Code").Width(100);
                columns.Bound(m => m.CPT_MOD).Title("CPT Mod").Width(100);
                columns.Bound(m => m.CPT_MOD2).Title("CPT Mod 2").Width(100);
                columns.Bound(m => m.CPT_MOD3).Title("CPT Mod 3").Width(100);
                columns.Bound(m => m.CPT_MOD4).Title("CPT Mod 4").Width(100);
                columns.Bound(m => m.FEE).Title("Fee").Width(100);
                columns.Bound(m => m.EFF_DTE).Title("Effective Date").Format("{0:MM/dd/yyyy}").Width(100);
                columns.Bound(m => m.EXP_DTE).Title("Expiration Date").Format("{0:MM/dd/yyyy}").Width(100);
                columns.Bound(m => m.STATE).Title("State/Carrier Locality").Width(100);
            })
            .DataBinding(dataBinding => dataBinding.Ajax().Select("_TextFileDataForFeeSrcFlatRateAjax", "FeeSrcFlatRate"))
            .ClientEvents(events => events.OnDataBinding("FeeSourceFlatDetailGrid_OnDataBinding"))
            .Footer(false)
)

And my controller action method:

[GridAction]
public ActionResult _TextFileDataForFeeSrcFlatRateAjax(FeeSourceFlatRateViewModel detailModel)
{
    detailModel = TempData["FeeSourceFlatRateViewModel"] as FeeSourceFlatRateViewModel;
 
    if (detailModel.ImportFileInfo != null)
    {
        detailModel = TempData["FeeSourceFlatRateViewModel"] as FeeSourceFlatRateViewModel;
 
        if (detailModel.ImportFileInfo != null)
        {
            GetFeeSourceFlatList(detailModel);
           }
    }
 
    TempData["FeeSourceFlatRateViewModel"] = detailModel;
 
    return View(new GridModel(detailModel.TextFileImportData));
}

My controller action method is never called, but when I view the page in the Firebug console, I see the data?! 

Any ideas why this is the case?  Thanks!
Tags
Grid
Asked by
Byron
Top achievements
Rank 1
Share this question
or