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

[Solved] Grid DetailView not rendering under master rows...

1 Answer 72 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.
Shannon
Top achievements
Rank 1
Shannon asked on 22 Dec 2011, 04:07 PM
I am using MVC 3 with the Telerik MVC extensions.  I am binding a grid to a model which is simply a wrapper around an object [Message] and a list of assocaited objects [MessageAttachment].  For each message I want to display a sub grid of the associated message attachment.

I followed the telerik sample code but the issue I'm experiencing is that the detail views are not displaying under their associated master row.  Instead the detail views are being rendered separately above the master rows - I have attached a screen shot of the resulting UI for reference.

Here is my code:  MVC 3, Razor

@(Html.Telerik().Grid(Model)

.Name(

 

"Messages")

 

.Columns(columns =>

{

columns.Bound(messageModel => messageModel.Message.ID).Width(100);

columns.Bound(messageModel => messageModel.Message.MessageTypeCode).Width(100);

columns.Bound(messageModel => messageModel.Message.Subject).Width(200);

columns.Bound(messageModel => messageModel.Message.Body);

columns.Bound(messageModel => messageModel.Message.AttachmentCount);

columns.Bound(messageModel => messageModel.Message.DateCreated).Width(200);

})

.DetailView(detailView => detailView.Template(messageModel =>

{

Html.Telerik().Grid(messageModel.MessageAttachments)

.Name(

 

"MessageAttachments_" + messageModel.Message.ID)

 

.Columns(columns =>

{

columns.Bound(messageAttachment => messageAttachment.ID);

columns.Bound(messageAttachment => messageAttachment.Extension);

})

.Pageable()

.Render();

}))

.RowAction(row =>

{

 

 

//Expand the first detail view

 

 

 

if (row.Index == 0)

 

{

row.DetailRow.Expanded =

 

true;

 

}

})

)

1 Answer, 1 is accepted

Sort by
0
william
Top achievements
Rank 1
answered on 29 Dec 2011, 10:47 AM
I can see that you are using the the following:

.DetailView(detailview => detailiew.Template......;..

try using detailview.ClientTemplate.

Template is used for server side, while clientTemplate is used for Client side
Tags
Grid
Asked by
Shannon
Top achievements
Rank 1
Answers by
william
Top achievements
Rank 1
Share this question
or