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

[Solved] Grid issue when adding Delete Command

4 Answers 123 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.
MGrassman
Top achievements
Rank 2
MGrassman asked on 19 Sep 2010, 04:52 AM
I have a grid that load via ajax and everything works fine.  When I add the Delete Command the grid causes the following javascript error.  I have tried to remove all code except the Grid and I get the same error?  Any suggestions as to what I'm doing wrong.  I have AJAX Gridss working in another project just fine.

MicrosoftMvcJQueryValidation.js:160

Uncaught TypeError: Cannot read property 'validationCallbacks' of null

Grid

<% Html.Telerik().Grid(Model.ZonesGridDisplay)
                .Name("gridLocationTypes")
                .DataKeys(keys =>
                {
                    keys.Add(m => m.ZoneId);
                })
                .HtmlAttributes(new
                {
                    style = string.Format("margin-top:10px;display:none;")
                })
                .DataBinding(dataBinding =>
                    {
                        dataBinding.Ajax()
                            .Select("_SelectZones", "Zone")
                            .Delete("_DeleteZones", "Zone");
                    })
  
                .Columns(columns =>
                {
                    columns.Bound(m => m.MarketName).Width(180);
                    columns.Bound(m => m.ZoneName).Width(180);
                    columns.Bound(m => m.ParentZoneName).Width(180);
                    columns.Bound(m => m.ModifiedDate).Width(180).ReadOnly();
                    columns.Bound(m => m.ModifiedBy).Width(180).ReadOnly();
                    columns.Command(commands => { commands.Delete(); }).Width(180).Title("Commands");
                })
                .Groupable(grouping => grouping
                    .Groups(groups =>
                    {
                        groups.Add(m => m.MarketName);
                    }))
  
                .Pageable()
                .Sortable()
                .Filterable()
                .Selectable()
                .ClientEvents(events => events.OnRowDataBound("gridLocationTypes_onRowDataBound"))
                .Render();     
        %>

Controller
[GridAction]
        public ActionResult _SelectZones()
        {
            //ZonesViewData viewData = ViewDataFactory.CreateBaseViewData<ZonesViewData>("Zone Setup");
            List<ZonesGridDisplay> zones = ZoneService.GetZonesForGridDisplay(null);
            return View(new GridModel(zones));
        }
  
        [GridAction]
        public ActionResult _DeleteZones(Guid id)
        {
            Zone zone = ZoneService.GetById(id);
            if (zone != null)
            {
                ZoneService.Delete(zone);
            }
            return View(new GridModel(ZoneService.GetZonesForGridDisplay(null)));
        }

4 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 20 Sep 2010, 07:55 AM
Hi MGrassman,

We have not encountered this problem before. Is it possible for you to open a support ticket and send us a small sample which reproduces this JavaScript error? We are not sure how to cause the error at our side in order to debug it.

All the best,
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
MGrassman
Top achievements
Rank 2
answered on 20 Sep 2010, 08:42 AM
Added ticket 349529

I now get it when I click on the market dropdown and not the grid action item.  but the error is the same.

Thanks,
0
MGrassman
Top achievements
Rank 2
answered on 20 Sep 2010, 08:43 PM
Figured it out.

I needed

<form id="gridLocationTypesform">
</form>
 at the bottom of my page.
0
Atanas Korchev
Telerik team
answered on 21 Sep 2010, 07:30 AM
Hello MGrassman,

 I think we have resolved a similar problem recently. I will send you a hotfix build in your support ticket so you can give it a try. Then you won't need that workaround.

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
MGrassman
Top achievements
Rank 2
Answers by
Atanas Korchev
Telerik team
MGrassman
Top achievements
Rank 2
Share this question
or