This question is locked. New answers and comments are not allowed.
I have a basic grid with Master/Detail nesting, I have used the demo/samples provided on this site and the data seems to be loading just fine. If I set the code to automatically expand the first row, it works, the data is there for both the Master and the detail records. However, when I click on the expand button for any row, the RowAction does not fire, and thus the detail for any other row will not display. What am I missing to get RowAction to fire when the expand button is clicked?
View code:
<table id="list" class="scroll" cellpadding="0" cellspacing="0">
<% Html.Telerik().Grid(Model)
.Name("MasterEvents")
.DataKeys(keys => keys.Add(e => e.master_event_id))
.DetailView(detailView => detailView.Template(e =>
{
Html.Telerik().Grid(e.utilityEvents)
.Name("activities_" + e.master_event_id)
.DataKeys(keys => keys.Add(c => c.event_id))
.Columns(columns =>
{
columns.Bound(o => o.event_id).Width(100);
columns.Bound(o => o.name).Width(200);
columns.Bound(o => o.description);
columns.Bound(o => o.start_date).Format("{0:MM/dd/yyyy}").Width(120);
columns.Bound(o => o.end_date).Format("{0:MM/dd/yyyy}").Width(120);
})
.Pageable()
.Render();
}))
.Columns(columns =>
{
columns.Bound(o => o.masterEvent.master_event_id).Width(100);
columns.Bound(o => o.masterEvent.title).Width(200);
columns.Bound(o => o.masterEvent.description);
columns.Bound(o => o.masterEvent.start_date).Format("{0:MM/dd/yyyy}").Width(120);
columns.Bound(o => o.masterEvent.end_date).Format("{0:MM/dd/yyyy}").Width(120);
})
.RowAction(row =>
{
if (row.Index == 0)
{
row.DetailRow.Expanded = true;
}
else
{
var requestKeys = Request.QueryString.Keys.Cast<string>();
var expanded = requestKeys.Any(key => key.StartsWith("activities_" + row.DataItem.master_event_id));
row.DetailRow.Expanded = expanded;
}
})
.Selectable()
.Sortable()
.Pageable()
.Render();
%>
Site.Master:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
<link href="../../Content/Themes/redmond/jquery-ui-1.8.5.custom.css" rel="stylesheet"
type="text/css" />
<title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title>
<%= Html.Telerik().StyleSheetRegistrar()
.DefaultGroup(group => group.Add("telerik.common.css").Add("telerik.vista.css").Combined(true).Compress(true)) %>
<script src="../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.jqGrid.min.js" type="text/javascript"></script>
</head>
<body>
<div id="logindisplay"></div>
<div id="menucontainer">
<h3> Events Scheduling System</h3>
<ul id="menu">
<li><%: Html.ActionLink("Events", "Index", "MasterEvent")%></li>
<li><%: Html.ActionLink("Locations", "Index", "Locations")%></li>
<li><%: Html.ActionLink("Resources", "Index", "Resources")%></li>
</ul>
</div>
<div id="main">
<asp:ContentPlaceHolder ID="MainContent" runat="server" />
</div>
<div id="footer">
</div>
<% Html.Telerik().ScriptRegistrar().DefaultGroup(group => group.Combined(true).Compress(true)); %></body>
</html>
View code:
<table id="list" class="scroll" cellpadding="0" cellspacing="0">
<% Html.Telerik().Grid(Model)
.Name("MasterEvents")
.DataKeys(keys => keys.Add(e => e.master_event_id))
.DetailView(detailView => detailView.Template(e =>
{
Html.Telerik().Grid(e.utilityEvents)
.Name("activities_" + e.master_event_id)
.DataKeys(keys => keys.Add(c => c.event_id))
.Columns(columns =>
{
columns.Bound(o => o.event_id).Width(100);
columns.Bound(o => o.name).Width(200);
columns.Bound(o => o.description);
columns.Bound(o => o.start_date).Format("{0:MM/dd/yyyy}").Width(120);
columns.Bound(o => o.end_date).Format("{0:MM/dd/yyyy}").Width(120);
})
.Pageable()
.Render();
}))
.Columns(columns =>
{
columns.Bound(o => o.masterEvent.master_event_id).Width(100);
columns.Bound(o => o.masterEvent.title).Width(200);
columns.Bound(o => o.masterEvent.description);
columns.Bound(o => o.masterEvent.start_date).Format("{0:MM/dd/yyyy}").Width(120);
columns.Bound(o => o.masterEvent.end_date).Format("{0:MM/dd/yyyy}").Width(120);
})
.RowAction(row =>
{
if (row.Index == 0)
{
row.DetailRow.Expanded = true;
}
else
{
var requestKeys = Request.QueryString.Keys.Cast<string>();
var expanded = requestKeys.Any(key => key.StartsWith("activities_" + row.DataItem.master_event_id));
row.DetailRow.Expanded = expanded;
}
})
.Selectable()
.Sortable()
.Pageable()
.Render();
%>
Site.Master:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
<link href="../../Content/Themes/redmond/jquery-ui-1.8.5.custom.css" rel="stylesheet"
type="text/css" />
<title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title>
<%= Html.Telerik().StyleSheetRegistrar()
.DefaultGroup(group => group.Add("telerik.common.css").Add("telerik.vista.css").Combined(true).Compress(true)) %>
<script src="../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.jqGrid.min.js" type="text/javascript"></script>
</head>
<body>
<div id="logindisplay"></div>
<div id="menucontainer">
<h3> Events Scheduling System</h3>
<ul id="menu">
<li><%: Html.ActionLink("Events", "Index", "MasterEvent")%></li>
<li><%: Html.ActionLink("Locations", "Index", "Locations")%></li>
<li><%: Html.ActionLink("Resources", "Index", "Resources")%></li>
</ul>
</div>
<div id="main">
<asp:ContentPlaceHolder ID="MainContent" runat="server" />
</div>
<div id="footer">
</div>
<% Html.Telerik().ScriptRegistrar().DefaultGroup(group => group.Combined(true).Compress(true)); %></body>
</html>