Story: We have 3 different tables. TimeReport, Dossier, BU The first one is connected to the second one, one to many. The second one is connected to the third one, one to many.
We wanted to use a radgrid component to display 'TimeReports'. We built in filters for example for 'DossierId' and are displaying the property 'Description'. This works fine.
Our problem is now that we want to display and filter for example BU.BUId and BU.Code. We tried this several ways, with java script or in code behind. Unfortunately it doesn't work. The problem seems to be that we want access the properties over two tables. (from 'TimeReport' over 'Dossier' to 'BU')
<telerik:GridBoundColumn DataField="Dossier.BU.Code" FilterControlAltText="Filter BUId column"
HeaderText="BU" SortExpression="BUId" UniqueName="BUId">
<FilterTemplate>
<telerik:RadComboBox ID="RadComboBoxTitle" DataSourceID="dsBU" DataTextField="Code"
DataValueField="BUId" AppendDataBoundItems="true" AutoPostBack="true"
OnPreRender="RadComboBoxTitle_PreRender"
runat="server" OnSelectedIndexChanged="RadComboBoxTitle_SelectedIndexChanged">
<Items>
<telerik:RadComboBoxItem Text="All" />
</Items>
</telerik:RadComboBox>
</FilterTemplate>
</telerik:GridBoundColumn>
Code behind
protected void RadComboBoxTitle_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
{
RadComboBox buCombo = sender as RadComboBox;
ViewState["buComboValue"] = buCombo.SelectedValue;
TimeReportGrid.MasterTableView.FilterExpression = "(it.[Dossier.BUId] = " + buCombo.SelectedValue + ")";
GridColumn column = TimeReportGrid.MasterTableView.GetColumnSafe("BUId");
column.CurrentFilterFunction = GridKnownFunction.EqualTo;
column.CurrentFilterValue = buCombo.SelectedValue;
TimeReportGrid.Rebind();
}
protected void RadComboBoxTitle_PreRender(object sender, EventArgs e)
{
if (ViewState["buComboValue"] != null)
{
RadComboBox buCombo = sender as RadComboBox;
buCombo.SelectedValue = ViewState["buComboValue"].ToString();
}
}
This Code throws an error on "TimeReportGrid.Rebind()".
'Dossier.BUId' is not a member of type 'Model.TimeReport' in the currently loaded schemas. Near escaped identifier, line 6, column 5.
Feel free to ask questions if necessary.
Thanks for your help and fast answer.