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

Asp.net mvc grid Ajax and Filter dialog problem

7 Answers 158 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.
hedayat
Top achievements
Rank 1
hedayat asked on 10 Nov 2009, 08:34 AM
I've crated a Grid with asp.net mvc extension, but i have tow problem with it.

filter dialog does not open and the grid does not work with ajax, i mean grid always postback pages for sorting and paging.

what is worng with me?

7 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 10 Nov 2009, 08:45 AM
Hello hedayat,

You have probably forgotten to add a ScriptRegistrar after the Grid. Please check this blog post for further details.

Regards,
Atanas Korchev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
hedayat
Top achievements
Rank 1
answered on 10 Nov 2009, 10:13 AM
I've added "<%= Html.Telerik().ScriptRegistrar() %>"  in the master page and my problem solved.

But i encounter to another problems. please look at the attatched pictures.

half of filter dialog showed (like the picture) and when i am sorting or paging the Grid i'll catch Error messege.

what shall i do ?
0
Atanas Korchev
Telerik team
answered on 10 Nov 2009, 10:17 AM
Hi hedayat,

The first error is rather strange. Can you reproduce it on our online demos?

The second error indicates that some server-side exception has occurred while making the request. Using FireBug or Fiddler would show what the stacktrace is. You can also try putting a breakpoint in your action method called via ajax.

Regards,
Atanas Korchev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
hedayat
Top achievements
Rank 1
answered on 10 Nov 2009, 10:29 AM
1- about my first problem, i couldn't underestand what do U mean

2- about second problem: i checked it, I did find any problem. please look at my code:

aspx:

<%= Html.Telerik().Grid(Model)  
      .Name("Grid")  
        .Columns(cols => 
                  { cols.Add(o => o.ReceiptNo);  
                  cols.Add(o => o.ReceptionDate);  
                  cols.Add(o => o.DriverFamily);  
                  cols.Add(o => o.DriverName);  
                                                           
                  })  
                .ServerBinding(serverBinding => serverBinding.Action("Index", "VRS_Estimate", new { ajax = ViewData["ajax"] }))  
                .Ajax(ajax => ajax.Enabled((bool)ViewData["ajax"]).Action("IndexAjax", "VRS_Estimate"))  
                .Scrollable(scrolling => scrolling.Enabled((bool)ViewData["scrolling"]))  
                .Sortable(sorting => sorting.Enabled((bool)ViewData["sorting"]))  
                .Pageable(paging => paging.Enabled((bool)ViewData["paging"]))  
                .Filterable(filtering => filtering.Enabled((bool)ViewData["filtering"]))  
        %> 

-----------Cs ---------

 

 public ActionResult Index(bool? ajax, bool? scrolling, bool? paging, bool? filtering, bool? sorting)  
        {  
            ViewData["ajax"] = ajax ?? true;  
            ViewData["scrolling"] = scrolling ?? true;  
            ViewData["paging"] = paging ?? true;  
            ViewData["filtering"] = filtering ?? true;  
            ViewData["sorting"] = sorting ?? true;  
            ViewData["Message"] = "Welcome to ASP.NET MVC!";  
 
            return View(_VRS_ReceptionService.GetVRS_Receptions());  
 
        }  
        [GridAction]  
        public ActionResult IndexAjax()  
        {  
            return View(new GridModel<VRS_Reception>  
            {  
                Data = _VRS_ReceptionService.GetVRS_Receptions()  
            });  
        }  
 

0
Atanas Korchev
Telerik team
answered on 10 Nov 2009, 11:27 AM
Hello hedayat,

About the first problem - do you reproduce it when browsing our online grid demos?

About the second - please try running with debugger and see if the IndexAjax method is not throwing any exceptions. HTTP code 500 means "Internal Server Error" and the most common reason is server-side exception.

By the way you don't need all those variables - ajax, scrolling, paging etc. They seem to be taken from the first look example and are not required at all by the grid. They were only used to enable the configurator. Please check this demo for a simpler ajax binding configuration.

Regards,
Atanas Korchev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
hedayat
Top achievements
Rank 1
answered on 11 Nov 2009, 07:53 AM
Hi.

1) I could solve the first problem, it was because of another scripts that added to my forms.

2) I've created another project with Telerik extention and in that ajax works very well, but i can't find out the problem in my main project, why telerik grid rase an Error with Ajax mode. Grid works very well without Ajax.

Tnx a lot
0
Atanas Korchev
Telerik team
answered on 11 Nov 2009, 09:06 AM
Hi hedayat,

Unfortunately I cannot help without first knowing what the exception is. Please try running your project with attached debugger. I am afraid I cannot help you further.

Regards,
Atanas Korchev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
hedayat
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
hedayat
Top achievements
Rank 1
Share this question
or