0
我的問題是,當我嘗試單擊我的Radgrid內的組合框時,它什麼也不做。通過組合框過濾RadGrid
<telerik:RadGrid ID="RadGrid" runat="server" DataSourceID="TestReleaseInformationSource" ShowStatusBar="true"
OnItemCommand="RadGridItemCommand" OnPreRender="RadGrid_PreRender" AllowAutomaticUpdates="true" EnableLinqExpressions="false"
AllowAutomaticDeletes="true" AllowPaging="true" AutoGenerateColumns="false" AllowFilteringByColumn="true">
<MasterTableView DataKeyNames="PrimaryKey">
<Columns>
<telerik:GridBoundColumn AllowFiltering="true" UniqueName="TeacherLastName" DataField="TeacherLastName" HeaderText="Last Name">
<FilterTemplate>
<telerik:RadComboBox ID="radComboBoxLastName" DataSourceID="TeacherLastNameDDL" DataTextField="TeacherLastName" DataValueField="TeacherLastName"
AppendDataBoundItems="true" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("TeacherLastName").CurrentFilterValue %>'
runat="server" OnClientSelectedIndexChanged="TeacherLastNameChanged">
<Items>
<telerik:RadComboBoxItem Text="All" Selected="true" />
</Items>
</telerik:RadComboBox>
<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
<script type="text/javascript">
function TeacherLastNameChanged(sender, args)
{
var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
tableView.filter("TeacherLastName", args.get_item().get_value(), "EqualTo");
}
</script>
</telerik:RadScriptBlock>
</FilterTemplate>
</telerik:GridBoundColumn>
在網格的預渲染
protected void RadGrid_PreRender(object sender, EventArgs e)
{
if (RadGrid.EditItems.Count > 0)
{
GridNestedViewItem item = (GridNestedViewItem)RadGrid.MasterTableView.GetItems(GridItemType.NestedView)[Convert.ToInt32(RadGrid.EditIndexes[0])];
item.Visible = false;
}
if (RadGrid.MasterTableView.FilterExpression != string.Empty)
{
RefreshCombos();
}
}
protected void RefreshCombos()
{
TestReleaseInformationSource.SelectCommand = TestReleaseInformationSource.SelectCommand + " WHERE " + RadGrid.MasterTableView.FilterExpression.ToString();
RadGrid.MasterTableView.Rebind();
}
我在這盯着幾個小時,不能找出問題所在。任何想法將不勝感激。如果需要,將發佈更多代碼。
我發現的解決方案是將組合框的RenderMode屬性設置爲本機。我仍然想要一個不同的解決方法。