Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1730
Ajax causing error for igGrid
posted

Hi,

I am using Asp.Net MVC3 and Infragistics grid.

I have a page with few controls and a search button. On the click of search, I am showing Search results in igGrid.

 

The Ajax Form code is as below:

@using (Ajax.BeginForm("Search", "Search", new AjaxOptions() { HttpMethod = "POST", InsertionMode = System.Web.Mvc.Ajax.InsertionMode.Replace, OnBegin = "BlockUI", OnComplete = "UnBlockUI", UpdateTargetId = "page" }))

{    

     <div class="div-left">          

              //other controls

            <div><br /><input type="submit" class="ui-button" value="Search" id="searchButton" /> </div>

       </div>

<div class="div-right">   

 @{ if (Model.SearchResults != null && Model.SearchResults.Count > 0)    

       {        @(Html       

                          .Infragistics().Grid<SearchSummary>(Model.SearchResults.AsQueryable()).ID("grid").AutoGenerateColumns(false)       

                         .Columns(col =>        {        col.For(x => x.SummaryName).HeaderText("Run Id");

                                                                   col.For(x => x.Inventory).HeaderText("Inventory");       

                                                                   col.For(x => x.Process).HeaderText("Process");    })

                         .Features(features => { features.Paging().PageSize(50).Type(OpType.Local);

                                                          features.Selection().Mode(SelectionMode.Row).MultipleSelection(false).Activation(true);

                                                          features.Filtering().Mode(FilterMode.Advanced).CaseSensitive(true); features.Sorting(); features.Resizing(); })        

                                                         .Height("700px") .DataBind() .Render() ) }

                      }            

</div>

}

 

When in click on SEARCH, first time the GRID gets loaded with data. But when I hit Search button second time, I get below error:

Microsoft JScript runtime error: Object doesn't support property or method 'igGrid'

Parents
No Data
Reply
  • 1730
    posted

    Hi,

    I found that the loader is getting removed on postback. Hence the error is coming.

    Below is my code with loader:

    @(Html.Infragistics().Loader()
                  .ScriptPath(Url.Content("~/Scripts/Ig"))
                  .CssPath(Url.Content("~/Content/Ig"))
                  .Render()
    )

    @using (Ajax.BeginForm("Search", "Search", new AjaxOptions() { HttpMethod = "POST", InsertionMode = System.Web.Mvc.Ajax.InsertionMode.Replace, OnBegin = "BlockUI", OnComplete = "UnBlockUI", UpdateTargetId = "page" }))

    {

                   //content controls   and submit button

    }

    When first time Ajax Postback hits, the Loader is present and grid gets loaded correctly. When the search button is hit for second time, the loader is not available.

    I believe this is happening because of AJAX. Additionally is there any way to inject loader using script ??

Children