This is a migrated thread and some comments may be shown as answers.
Grid Page Url Problem
9 Answers 98 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Nate
Top achievements
Rank 1
Nate asked on 07 Jun 2010, 08:51 PM
Hi

I have a question about a Grid Page URL construction. I'm using Ajax Binding for my grid and the grid actions(paging, sorting) URL's are derived from the current action and controller. Here is my Code snippets:

Index.aspx

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <div id="inputDetails">

      <%
       using (Ajax.BeginForm("Lookup", "OrderStatus", new { }, new AjaxOptions { UpdateTargetId = "orderStatusDetails", LoadingElementId = "busy"}))
          {%>

   <table border="0">
       <tr>
    <td>DeliveryDate:</td>
    <td><%=Html.Telerik().DatePicker().Name("DeliveryDate").MinDate(new DateTime(1900,1,1)).Value(Model.DeliveryDate).Format("MM/dd/yyyy")%></td>
    <td><button class="t-button t-state-default" type="submit">Look Up</button></td>
    </tr>
   </table>
 
   <%
          }
       %>
 </div>
 <div id="busy" style="color: green; display:none" align="center" >
      <img src="<%= Url.Content("~/Content/Vista/ajax-loader.gif")%>" alt=""/>
  </div>
      
 <div id="orderStatusDetails">
    <% Html.RenderPartial("Lookup",Model); %>  
 </div>      
   
</asp:Content>

LookUp.ascx

<div id="orderStatus">
   <div style="color: red;">
    <%Html.RenderPartial("StatusMessage",Model); %>
  </div>
      <% if (Model.OrderStatusDetails != null && Model.OrderStatusDetails.Count > 0)
         {%>
            <h3>Order Status Details</h3>  
         <p>              
                <%Html.Telerik().Grid(Model.OrderStatusDetails)
                                   .Name("OrderStatusDetails")
                                   .DataBinding(dataBinding => dataBinding.Ajax().Select("AJaxOrderStatus", "OrderStatus"))
                                   .Columns(columns =>
                                        {
                                            columns.Bound(os => os.Alert).Width(40);
                                            columns.Bound(os => os.DispenseDt).Width(70).Title("Dispensed").Format("{0:MM/dd/yyyy}");
                                            columns.Bound(os => os.PatLName).Width(80).Title("Last Name");
                                            columns.Bound(os => os.PatFName).Width(80).Title("First Name");
                                            columns.Bound(os => os.NsId).Width(40).Title("Station");
                                            columns.Bound(os => os.Room).Width(40);
                                            columns.Bound(os => os.Bed).Width(40);
                                            columns.Bound(os => os.DrugLabelName).Width(180).Title("Drug");
                                            columns.Bound(os => os.RxNo).Width(50);
                                            columns.Bound(os => os.Qty).Width(40);
                                            columns.Bound(os => os.DaysSupply).Width(40).Title("Days");
                                            columns.Bound(os => os.RxStatDescr).Width(60).Title("Status");
                                            columns.Bound(os => os.RxStatMsg).Width(60).Title("Message");
                                            columns.Bound(os => os.LastStepComplete).Width(100).Title("Last Step");
                                            columns.Bound(os => os.LastStepCompleted).Width(70).Title("Completed").Format("{0:MM/dd/yyyy}");;
                                            columns.Bound(os => os.DelivID).Width(50).Title("Delivery");
                                        })
                                   .CellAction(cell =>
                                    {
                                        if (cell.Column.Title == "Alert" && !string.IsNullOrEmpty(cell.DataItem.Alert))
                                        {
                                                //Set the background of this cell only
                                            cell.HtmlAttributes["style"] = "font-weight: bold; color: red";
                                        }
                                    })
                                   .Scrollable()
                                   .Pageable(p => p.PageSize(15))
                                   .Sortable(s=> s.SortMode(GridSortMode.MultipleColumn))
                                   .Render();
                                   %>       
            </p>
         <%
         }%>
</div>

When i click the paging and  sorting in the grid it's taking me to the Lookup action instead of the the Ajax binding Action AJaxOrderStatus.

Controller Actions

        [Authorize]
        public ActionResult Index()
        {
                var orderStatus = SessionOrderStatusData;
                return View(orderStatus); 
        }

        [Authorize]
        [GridAction]
        public ActionResult AJaxOrderStatus()
        {
                var orderModel = SessionOrderStatusData;
                return View(new GridModel { Data = orderModel.OrderStatusDetails });
        }

        [Authorize]
        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Lookup(FormCollection collection)
        {
           //Some implementation to retrieve data
        }


9 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 08 Jun 2010, 06:39 AM
Hi Netsanet Gizaw,

This can occur if the JavaScript files required by the grid are not included. Make sure you have a ScriptRegistrar component. Check the general troubleshooting help topic for more info.

Greetings,
Atanas Korchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Nate
Top achievements
Rank 1
answered on 08 Jun 2010, 02:57 PM
Hi Atanas,

Thanks for quick reply. I have this script registrar in the Site Master:

<%= Html.Telerik().ScriptRegistrar().DefaultGroup(group =>
        {
            group.Add("jquery-ui-1.8.1.custom.min.js");
            group.Add("telerik.common.min.js");
            group.Add("telerik.grid.min.js");
            group.Add("telerik.grid.editing.min.js");

        })   
    %>

But still the Grid actions Paging/Sorting URL is pointing to the Lookup action. And also after adding the js files, i see this error in my log in page......

Webpage error details

Message: 'undefined' is null or not an object
Line: 1
Char: 63
Code: 0
URI: http://localhost/MyRemedi/Scripts/2010.1.416/telerik.grid.min.js

Thanks for help in Advance.
0
Atanas Korchev
Telerik team
answered on 08 Jun 2010, 03:08 PM
Hi Netsanet Gizaw,

Perhaps there is a missing JavaScript file. Please check the required JavaScript files help topic and verify that all JavaScript dependencies are resolved.

Regards,
Atanas Korchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Nate
Top achievements
Rank 1
answered on 08 Jun 2010, 03:51 PM
Hi Atanas,


I registered all the necessary javascript files in the site master necessary for the grid actions, but no difference. Any other clue?

Thanks,

0
Atanas Korchev
Telerik team
answered on 08 Jun 2010, 03:59 PM
Hi Netsanet Gizaw,

What files did you register? Could you paste the updated ScriptRegistrar? Perhaps this would shed more light.

Regards,
Atanas Korchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Nate
Top achievements
Rank 1
answered on 08 Jun 2010, 04:15 PM
Hey,

Here is My script registrar:

<%= Html.Telerik().ScriptRegistrar().DefaultGroup(group =>
        {
            group.Add("jquery-ui-1.8.1.custom.min.js");
            group.Add("telerik.common.min.js");
            group.Add("jquery.validate.min.js");
            group.Add("telerik.grid.min.js");
            group.Add("telerik.grid.editing.min.js");
            group.Add("telerik.calendar.min.js");
            group.Add("telerik.datepicker.min.js");

        })   
    %>
0
Atanas Korchev
Telerik team
answered on 08 Jun 2010, 04:26 PM
Hello Netsanet Gizaw,

If you have a numeric column you have to include telerik.textbox.min.js as well. If not - this should be enough. I guess sending a sample project is the last thing remaining. You can use some public file hosting web site to do that.

Regards,
Atanas Korchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Nate
Top achievements
Rank 1
answered on 08 Jun 2010, 04:59 PM
This is annoying i have added everything even the textbox.js. Which in the Required JavaScript files section of the manual says add it if you enable filtering but i don't have filtering functionality.

<%= Html.Telerik().ScriptRegistrar().DefaultGroup(group =>
        {
            group.Add("jquery-ui-1.8.1.custom.min.js");
            group.Add("telerik.common.min.js");
            group.Add("jquery.validate.min.js");
            group.Add("telerik.grid.min.js");
            group.Add("telerik.grid.editing.min.js");
            group.Add("telerik.calendar.min.js");
            group.Add("telerik.datepicker.min.js");
            group.Add("telerik.textbox.min.js");
        })   
    %>


0
Atanas Korchev
Telerik team
answered on 09 Jun 2010, 07:44 AM
Hi Netsanet Gizaw,

It is very strange indeed. There must be a reason for this JavaScript error to occur. Unfortunately I cannot tell what this could be unless I reproduce the problem. Please provide a sample project which depicts the issue. You can use a public file storage web site such as dropbox.com, skydrive.com etc.

Regards,
Atanas Korchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
Nate
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Nate
Top achievements
Rank 1
Share this question
or