This question is locked. New answers and comments are not allowed.
Hello,
I successfully developed a two level master/detail grid in MVC3 using the Telerik Q2 2012 release. When I add a third level, the Master grid appears but the two detail grids do not appear. Here is the code for the three level Grid snippet:
----------------------------------------------------------------------------------------------------------------------------
<div class="span-24 last">
<div class="prepend-1 span-22 append-1 last">
@(Html.Telerik().Grid<StudyDefinitionModel>()
.Name("StudyReferences")
.Columns(columns =>
{
columns.Bound(m => m.StudyId);
columns.Bound(m => m.StudyOIDName);
})
.ClientEvents(studyReferences => studyReferences.OnRowDataBound("studyReferences_onRowDataBound"))
.DataBinding(dataBinding => dataBinding.Ajax().Select("StudyReferencesAjax", "StudyReferences"))
.Pageable()
.Sortable()
.Filterable()
.DetailView(treatmentGroupReferences => treatmentGroupReferences.ClientTemplate
(
Html.Telerik().Grid<TreatmentGroupReferenceModel>()
.Name("TreatmentGroupReferences_<#= StudyId #>")
.Columns(columns =>
{
columns.Bound(m => m.TreatmentGroupShortName);
columns.Bound(m => m.TreatmentGroupName);
columns.Bound(m => m.TreatmentGroupOidName);
})
.ClientEvents(treatmentGroups => treatmentGroups.OnRowDataBound("treatmentGroups_onRowDataBound"))
.DataBinding(dataBinding => dataBinding.Ajax().Select("TreatmentGroupReferencesAjax", "StudyReferences", new { studyId = "<#= StudyId #>" }))
.Pageable()
.Sortable()
.Filterable()
.ToHtmlString()
))
.DetailView(eventReferences => eventReferences.ClientTemplate
(
Html.Telerik().Grid<CommonEventReferenceModel>()
.Name("Event_<#= EventId #>")
.Columns(columns =>
{
columns.Bound(e => e.StudyId);
columns.Bound(e => e.TreatmentGroupOidName);
columns.Bound(e => e.EventId);
columns.Bound(e => e.EventName);
columns.Bound(e => e.EventMandatoryFlag);
})
.ClientEvents(eventClientReferences => eventClientReferences.OnRowDataBound("eventClientReferences_onRowDataBound"))
.DataBinding(dataBinding => dataBinding.Ajax().Select("EventReferenceAjax", "StudyReferences", new { treatmentGroupOidName = "<#= TreatmentGroupOidName #>" }))
.Pageable()
.Sortable()
.Filterable()
.ToHtmlString()
))
)
</div>
</div>
<script type="text/javascript">
function expandFirstRow( grid, row )
{
if ( grid.$rows().index( row ) == 0 )
{
grid.expandRow( row );
}
}
function studyReferences_onRowDataBound( e )
{
var grid = $( this ).data( 'tGrid' );
expandFirstRow( grid, e.row );
}
function treatmentGroups_onRowDataBound( e )
{
var grid = $( this ).data( 'tGrid' );
expandFirstRow( grid, e.row );
}
function eventClientReferences_onRowDataBound( e )
{
var grid = $( this ).data( 'tGrid' );
expandFirstRow( grid, e.row );
}
</script>
-------------------------------------------------------------------------------------------------------------------------------
Here is the Controller code snippet:
Any help would be appreciated.
Phil
I successfully developed a two level master/detail grid in MVC3 using the Telerik Q2 2012 release. When I add a third level, the Master grid appears but the two detail grids do not appear. Here is the code for the three level Grid snippet:
----------------------------------------------------------------------------------------------------------------------------
<div class="span-24 last">
<div class="prepend-1 span-22 append-1 last">
@(Html.Telerik().Grid<StudyDefinitionModel>()
.Name("StudyReferences")
.Columns(columns =>
{
columns.Bound(m => m.StudyId);
columns.Bound(m => m.StudyOIDName);
})
.ClientEvents(studyReferences => studyReferences.OnRowDataBound("studyReferences_onRowDataBound"))
.DataBinding(dataBinding => dataBinding.Ajax().Select("StudyReferencesAjax", "StudyReferences"))
.Pageable()
.Sortable()
.Filterable()
.DetailView(treatmentGroupReferences => treatmentGroupReferences.ClientTemplate
(
Html.Telerik().Grid<TreatmentGroupReferenceModel>()
.Name("TreatmentGroupReferences_<#= StudyId #>")
.Columns(columns =>
{
columns.Bound(m => m.TreatmentGroupShortName);
columns.Bound(m => m.TreatmentGroupName);
columns.Bound(m => m.TreatmentGroupOidName);
})
.ClientEvents(treatmentGroups => treatmentGroups.OnRowDataBound("treatmentGroups_onRowDataBound"))
.DataBinding(dataBinding => dataBinding.Ajax().Select("TreatmentGroupReferencesAjax", "StudyReferences", new { studyId = "<#= StudyId #>" }))
.Pageable()
.Sortable()
.Filterable()
.ToHtmlString()
))
.DetailView(eventReferences => eventReferences.ClientTemplate
(
Html.Telerik().Grid<CommonEventReferenceModel>()
.Name("Event_<#= EventId #>")
.Columns(columns =>
{
columns.Bound(e => e.StudyId);
columns.Bound(e => e.TreatmentGroupOidName);
columns.Bound(e => e.EventId);
columns.Bound(e => e.EventName);
columns.Bound(e => e.EventMandatoryFlag);
})
.ClientEvents(eventClientReferences => eventClientReferences.OnRowDataBound("eventClientReferences_onRowDataBound"))
.DataBinding(dataBinding => dataBinding.Ajax().Select("EventReferenceAjax", "StudyReferences", new { treatmentGroupOidName = "<#= TreatmentGroupOidName #>" }))
.Pageable()
.Sortable()
.Filterable()
.ToHtmlString()
))
)
</div>
</div>
<script type="text/javascript">
function expandFirstRow( grid, row )
{
if ( grid.$rows().index( row ) == 0 )
{
grid.expandRow( row );
}
}
function studyReferences_onRowDataBound( e )
{
var grid = $( this ).data( 'tGrid' );
expandFirstRow( grid, e.row );
}
function treatmentGroups_onRowDataBound( e )
{
var grid = $( this ).data( 'tGrid' );
expandFirstRow( grid, e.row );
}
function eventClientReferences_onRowDataBound( e )
{
var grid = $( this ).data( 'tGrid' );
expandFirstRow( grid, e.row );
}
</script>
-------------------------------------------------------------------------------------------------------------------------------
Here is the Controller code snippet:
public ActionResult Index() { return View(); } [GridAction] public ActionResult StudyReferencesAjax () { var studyDefinitionViewModelForTheIndexView = _studyDefinitionService.CreateTheIndexViewModel(new GetIndexViewModelRequestMsg { GridCommand = new GridCommand(), PersonId = PersonId, Task = Enums.Task.GetAll, UserMsg = new UserMsg(), Area = Enums.Area.EStudySetup }); return View(new GridModel(studyDefinitionViewModelForTheIndexView.StudyGrid)); } [GridAction] public ActionResult TreatmentGroupReferencesAjax (string studyId) { var treatmentGroupReferenceViewModel = _treatmentGroupReferenceService.CreateTheIndexViewModel( new GetIndexViewModelRequestMsg { GridCommand = new GridCommand(), PersonId = PersonId, Task = Enums.Task.GetAll, UserMsg = new UserMsg(), Area = Enums.Area.EStudySetup }, Convert.ToInt32(studyId), "CDASH"); return View(new GridModel(treatmentGroupReferenceViewModel.TreatmentGroupReferences)); } [GridAction] public ActionResult EventReferenceAjax(string treatmentGroupOidName) { var cdashId = 368; var eventReferenceViewModel = _commonEventReferenceService.CreateTheIndexViewModel( new GetIndexViewModelRequestMsg { PersonId = PersonId, Task = Enums.Task.GetAll, UserMsg = new UserMsg(), Area = Enums.Area.EStudySetup }, cdashId, treatmentGroupOidName); return View(new GridModel(eventReferenceViewModel.CommonEventReferences)); }-------------------------------------------------------------------------------------------------------------------------------------------------
Any help would be appreciated.
Phil