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

RadGrid in TabStrip in Detail Table in RadGrid

1 Answer 193 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 03 Apr 2019, 11:05 AM

Hi all,

I have a 'people' view listing users in a RadGrid, with an expand icon to show a detail table for each user.  Inside the detail table I have a tabstrip separating areas for the user.  My latest tab is 'documents' which needs to be dynamically generated server side, and contains a list of categorised (by tabs) list (in radgrids) of documents.  My application is working ok, except when I open/expand another user's detail table.  The documents tab renders correctly for the current open user only.  All of the others just disappear.  See screenshot attached for reference.

I am using the itemcommand event to check for the existence of the tabstrip tab(s) and if it exists I add the radgrid(s) (to the documents tabs), and if it does not I create the tab(s) and then add the radgrid(s).

Any ideas?  Is there a better way to do this?  I notice when I expand the details view the entire parent radgrid refreshes (loading panel).  Is there a way, perhaps, just to refresh the open details view?

Thanks,
Alex.

1 Answer, 1 is accepted

Sort by
0
Attila Antal
Telerik team
answered on 08 Apr 2019, 09:39 AM
Hi Alex,

Creating controls dynamically could become quite tricky as many things in ASP.NET AJAX depend on the Page's Lifecycle and ViewState. More specifically, creating RadGrid programmatically, must be done in specific events of the Page. For instance, the Init event would be the best, meaning that neither of the events such as ItemCommand, ItemCreated, ItemDataBound, etc.. are optimal for that. I advise checking out the following article that describes several scenarios for creating a grid dynamically: Creating a RadGrid Programmatically.

Furthermore, the outcome depends very much on the DataBinding technique as well. For complex scenarios we recommend using the Advanced Data-binding (Using NeedDataSource Event), and in that case ensure that the DataBind() method is not being called anywhere in the code behind as it could cause unexpected behavior.

There are two ways for creating RadGrid hierarchy, either using DetailTables or using NestedViewTemplate. From the screenshot you have shared, I assume NestedViewTemplate is used, is that correct? 

I would also recommend checking out the Hierarchy load modes article that might be helpful in your case. If the load mode is set to client, every child control of the grid is rendered at once, if its set to server, child controls get rendered when the Hierarchical item is getting expanded.

In any case, it would be very helpful if you could provide us more detail on the current configuration so that we can understand the structure, scenario and then we can advise you accordingly. The best would be if you could share the markup code and the code behind so that we can take a look.

Kind regards,
Attila Antal
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
Alex
Top achievements
Rank 1
Answers by
Attila Antal
Telerik team
Share this question
or