views:

52

answers:

0

I am using free Telerik.Web.Mvc grid and following this example: http://demos.telerik.com/aspnet-mvc/grid/hierarchyajax

My Issue:

I am populating the grid with search results after user input some data and submit with a search button In the DetailView() method I reference my 'SearchQuote_QuotesForHierarchyAjax' method, which is in defined in my Controller when DetailView executes data should be fetched, but this controller action does not execute for me.

If i load the grid first time page loads it execute. but not when the grid is loaded in a search button click

The Code in my project:

My SearchQuote.aspx View looks like this

  <%= Html.Telerik().Grid(Model.QuoteSummaryList)
                .Name("SearchQuoteGrid")
    .Columns(columns =>
    {
        columns.Bound(q => q.QuoteId).Title("Quote #").Width(50);
        columns.Bound(q => q.AxiomId).Title("Axiom Id").Width(180);

    })
     .ClientEvents(events => events.OnRowDataBound("quotes_onRowDataBound"))
    .DetailView(details => details.ClientTemplate(
     Html.Telerik().Grid(Model.QuoteSubSummaryList)
        .Name("Quotes_<#= QuoteId #>")
        .Columns(columns =>
        {
            columns.Bound(o => o.PositionCode).Width(101);
            columns.Bound(o => o.Group).Width(140);
        })
        .DataBinding(dataBinding => dataBinding.Ajax()
        .Select("SearchQuote_QuotesForHierarchyAjax", "SearchQuote", new
        {quoteid ="<#= QuoteId #>"}))
        .Pageable()
        .Sortable()
        .Filterable()
        .ToHtmlString()
    ))
    .DataBinding(dataBinding => dataBinding.Ajax()
                                .Select("SearchQuote_Select", "SearchQuote"))
    .Sortable()
    .Pageable(p => p.PageSize(3))
%>
<script type="text/javascript">

function expandFirstRow(grid, row) {
      if (grid.$rows().index(row) == 0) {
          grid.expandRow(row);
      }
   }

   function quotes_onRowDataBound(e) {
        var grid = $(this).data('tGrid');
        expandFirstRow(grid, e.row);
    }
</script>

And SearchQuoteController has this code.

    [AcceptVerbs(HttpVerbs.Post)]
    [GridAction]
    public ActionResult SearchQuote_QuotesForHierarchyAjax(int quoteid)
    {
       List<QuoteLineSummaryDM> sublist = new List<QuoteLineSummaryDM>();

       QuoteLineSummaryDM a = new QuoteLineSummaryDM();
         a.PositionCode =  "50";
         a.Group = "1";
         sublist.Add(a);

       QuoteLineSummaryDM b = new QuoteLineSummaryDM();
         b.PositionCode =  "40";
         b.Group = "2";
         sublist.Add(b);

         var qrows = (from r in sublist
                      select r).AsQueryable();

         return View(new GridModel(qrows));
    }

What am I missing? My version is even simpler than the demo. Any ideas?

Thanks.

I found another grid that does what I want to do. It's called jqGrid