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

Grid Hierarchy breaks when I add radWindow as edit form

1 Answer 31 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Craig
Top achievements
Rank 1
Iron
Craig asked on 05 Mar 2015, 01:44 PM
Hi,

I've been using hierarchical grids for years and also your window edit for grids (http://demos.telerik.com/aspnet-ajax/window/examples/demoemail/defaultcs.aspx) for years without any problems but when I try to use the window edit technique from your above demo on a hierarchical grid I get the following error when I try to expand a child table:

Error: Sys.WebForms.PageRequestManagerServerErrorException: Object reference not set to an instance of an object.

Is it possible to do what I'm trying to do with the demo technique or do I have to do it differently?

Thanks,

Craig

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 10 Mar 2015, 09:41 AM
Hi Craig,

You should be able to have the same implementation with hierarchical RadGrid as well, but you will have to ensure that the GridDataItem firing the OnItemCreated event is from the MasterTableView and not from the DetailTables. You can determine which item is currently firing the event by using the e.Item.OwnerTableView.Name property, which will return the name of the GridTableVIew:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
        GridDataItem dataItem = e.Item as GridDataItem;
        if (dataItem.OwnerTableView.Name == "DetailTable1")
        {
            // your logic for items within the detail tables
        }
        else
        {
            // your logic for items in the MasterTableView
        }
    }
}

If the above does not help you can temporarily disable the AJAX for your RadGrid and see the full stack trace of the error and locate what is throwing it.

Hope this helps.


Regards,
Konstantin Dikov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Craig
Top achievements
Rank 1
Iron
Answers by
Konstantin Dikov
Telerik team
Share this question
or