I can't figure it out. I have AllowFilteringByColumn set to true on the main grid, so I thought it was supposed to allow it for all underlying tables, but everytime I attempt filtering a details table, I get a blank screen.
Here's the code:
aspx:
<telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True"
AllowPaging="True" AllowSorting="True" GridLines="None"
ondetailtabledatabind="RadGrid1_DetailTableDataBind"
onneeddatasource="RadGrid1_NeedDataSource" Skin="WebBlue">
<MasterTableView AutoGenerateColumns="false" DataKeyNames="ProjNo">
<DetailTables>
<telerik:GridTableView runat="server" ShowFooter="True">
<RowIndicatorColumn>
<HeaderStyle Width="20px" />
</RowIndicatorColumn>
<ExpandCollapseColumn>
<HeaderStyle Width="20px" />
</ExpandCollapseColumn>
</telerik:GridTableView>
</DetailTables>
<RowIndicatorColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
<ExpandCollapseColumn Visible="True">
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn DataField="ProjNo" DataType="System.Int32"
HeaderText="Project Number" ReadOnly="True" SortExpression="ProjNo"
UniqueName="ProjNo">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ProjectName" HeaderText="Project Name"
SortExpression="ProjectName" UniqueName="ProjectName">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="DateCreated" DataType="System.DateTime"
HeaderText="Date Created" SortExpression="DateCreated"
UniqueName="DateCreated">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ProjectStatus" HeaderText="Project Status"
SortExpression="ProjectStatus" UniqueName="ProjectStatus">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="POCName" HeaderText="Point Of Contact"
ReadOnly="True" SortExpression="POCName" UniqueName="POCName">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<ClientSettings>
<Scrolling AllowScroll="True" UseStaticHeaders="True" />
</ClientSettings>
<FilterMenu EnableTheming="True" Skin="Vista">
<CollapseAnimation Type="OutQuint" Duration="200">
</CollapseAnimation>
</FilterMenu>
</telerik:RadGrid>
CODE BEHIND:
private string user = "jrpuser";
protected void Page_Load(object sender, EventArgs e)
{
}
protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
GridData gd = new GridData();
RadGrid1.DataSource = gd.GetProjects(user);
}
protected void RadGrid1_DetailTableDataBind(object source, Telerik.Web.UI.GridDetailTableDataBindEventArgs e)
{
GridData gd = new GridData();
GridDataItem masterItem = (GridDataItem)e.DetailTableView.ParentItem;
e.DetailTableView.DataSource = gd.GetProjectDetails(user, Convert.ToInt16(masterItem.GetDataKeyValue("ProjNo")));
}
BUSINESS OBJECTS:
public DataTable GetProjects(string user)
{
SqlDataAdapter da = null;
DataTable table = new DataTable();
SqlConnection conn = null;
SqlCommand cmd = null;
string connection;
piiConnection strcon = new piiConnection();
try
{
connection = strcon.getConnection();
conn = new SqlConnection(connection);
cmd = new SqlCommand("spGetProjects", conn);
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.Parameters.Add(new SqlParameter("@User", user));
da = new SqlDataAdapter(cmd);
conn.Open();
da.Fill(table);
}
finally
{
conn.Close();
}
return table;
}
public DataTable GetProjectDetails(string user, int id)
{
SqlDataAdapter da = null;
DataTable table = new DataTable();
SqlConnection conn = null;
SqlCommand cmd = null;
string connection;
piiConnection strcon = new piiConnection();
try
{
connection = strcon.getConnection();
conn = new SqlConnection(connection);
cmd = new SqlCommand("spGetProjectDetails", conn);
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.Parameters.Add(new SqlParameter("@User", user));
cmd.Parameters.Add(new SqlParameter("@ProjNo", id));
da = new SqlDataAdapter(cmd);
conn.Open();
da.Fill(table);
}
finally
{
conn.Close();
}
return table;
}