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

Delete throwing Jscript error

0 Answers 9 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.
David
Top achievements
Rank 1
David asked on 18 Nov 2011, 06:36 PM
I’m really in a bind and not sure what is going wrong.

Overview
I have a simple ASP.NET MVC 3 Telerik grid containing "User" records.  When a row is selected/clicked I open a Telerik Window which has a Telerik TabStrip.  In one of the tabs I have a Telerik grid which contains “Aattribute” data.

When a user clicks the delete button an exception is thrown.

Microsoft JScript runtime error: “Skill.ID” is null or not an object. 
I can “Break”, “Continue”, or “Ignore” the error. If I Ignore the issue the correct ID value is passed to the action method and the delete takes place.

The data originally being bound to the grid is all there and being displayed. Don’t understand why the client side javascript throws the error.  In a bind and could really use some help on this one.

--> See attached debug screen shot

Many thanks in advance.

The partial view with the "Attribute" grid
  
<h3>Assigned Attributes</h3>
  
@(Html.Telerik().Grid<GCSAdminPoco.UserSkill>()
    .Name("UserAttributeGrid")
    //.Editable(editing => editing.Mode(GridEditMode.PopUp))
    .DataKeys(dataKeys =>
    {
        dataKeys.Add(k => k.Skill.ID);
    }
    )
    .DataBinding(dataBinding => dataBinding
        .Ajax()
            .Select("SelectUserAttributes", "User")
            .Delete("DeleteUserAttribute", "User")
        )
    .Columns(columns =>
    {
        columns.Bound(c => c.Skill.Name).Title("Skill");
        columns.Bound(c => c.Proficiency).Title("Proficiency");
  
        columns.Command(commands =>
        {
            commands.Delete().ButtonType(GridButtonType.Image);
  
        }).Width(45);
  
    })
    .Scrollable(scrolling => scrolling.Height("200px"))
    .Filterable(filtering => filtering.Enabled(true))
    .Sortable()
    .Pageable(pager => pager.PageSize(10))
)
Objects being bound
  
[Serializable]
public class UserSkill
{
    public int ID { get; set; }
    public AttributeSkill Skill { get; set; }
    public UserInfo User { get; set; }
    public string Proficiency { get; set; }
}
  
[Serializable]
public class AttributeSkill
{
    public int ID { get; set; }
    public string Name { get; set; }
    public string Weight { get; set; }
}

Tags
Grid
Asked by
David
Top achievements
Rank 1
Share this question
or