Hi,
I am facing a issue while filter a radgrid. I have a filter Expression written in my program and that is throwing some exception while runing. Please solve me this issue ASAP. I will attach my code here with the exception message what I am facing while Running.
I am facing a issue while filter a radgrid. I have a filter Expression written in my program and that is throwing some exception while runing. Please solve me this issue ASAP. I will attach my code here with the exception message what I am facing while Running.
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"> <script type="text/javascript"> function showMenu(e) { var contextMenu = $find("<%= RadContext.ClientID %>"); contextMenu.show(e); } var combo; function OnClientLoad(sender, args) { combo = sender; } function getFilterComboBox() { var comboItem = combo.get_selectedItem(); // combo represents the FilterCombo document.getElementById('<%=hdnRadCombo.ClientID %>').value = comboItem._text; } </script> <telerik:RadGrid runat="server" ID="JobSummaryGrid" AllowFilteringByColumn="true" AutoGenerateColumns="false"> <MasterTableView AllowFilteringByColumn="true" AllowSorting="true" AllowPaging="true"> <Columns> <telerik:GridBoundColumn DataField="header" DataType="System.String" HeaderText="Header" UniqueName="Header" FilterControlWidth="70px"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="details" DataType="System.String" HeaderText="details" UniqueName="details" FilterControlWidth="70px"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="orgin" DataType="System.String" HeaderText="orgin" UniqueName="orgin" FilterControlWidth="70px"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="contenttitle" DataType="System.String" HeaderText="contenttitle" UniqueName="contenttitle" FilterControlWidth="70px" > </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="JoinDate" DataType="System.DateTime" HeaderText="JoinDate" UniqueName="JoinDate" FilterControlWidth="70px"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="serviceType" DataType="System.String" HeaderText="serviceType" UniqueName="serviceType" FilterControlWidth="70px" ShowFilterIcon="true" AllowFiltering="true"> <FilterTemplate> <telerik:RadComboBox runat="server" ID="radCombobox1" DataTextField="serviceType" DataValueField="serviceType" OnClientLoad="OnClientLoad" OnClientSelectedIndexChanged="getFilterComboBox"> <Items> <telerik:RadComboBoxItem Text="serviceType1" /> <telerik:RadComboBoxItem Text="serviceType2" /> <telerik:RadComboBoxItem Text="serviceType3" /> </Items> </telerik:RadComboBox> <img src="FilterIcon.JPG" alt="Landscape" width="22px" onclick="showMenu(event)" /> <asp:ImageButton runat="server" ID="imgButtonClearFilter" ImageUrl="~/ClearFilter.jpeg" OnClick="clearFilter" /> </FilterTemplate> </telerik:GridBoundColumn> </Columns> </MasterTableView> </telerik:RadGrid> <telerik:RadScriptManager runat="server"> </telerik:RadScriptManager> <telerik:RadContextMenu runat="server" ID="RadContext" onitemclick="RadContext_ItemClick"> <Items> <telerik:RadMenuItem Text="EqualTo"/> </Items> </telerik:RadContextMenu> <asp:Label ID="Label1" runat="server" Text=""></asp:Label> <asp:HiddenField ID="hdnRadCombo" runat="server" /> </asp:Content>protected void RadContext_ItemClick(object sender, RadMenuEventArgs e) { radComboboxSelectedString = hdnRadCombo.Value; switch (e.Item.Text) { case "EqualTo": foreach (GridBoundColumn column in JobSummaryGrid.MasterTableView.Columns) { if (column.UniqueName == "serviceType") { JobSummaryGrid.MasterTableView.FilterExpression = "(Convert.ToString(it[serviceType])=" + radComboboxSelectedString + ")";//"it.serviceType ="+radComboboxSelectedString+""; //JobSummaryGrid.MasterTableView.FilterExpression = "(it"+"[ Header]"+".ToString().StartsWith("+"6"+"))"; column.CurrentFilterFunction = GridKnownFunction.EqualTo; JobSummaryGrid.MasterTableView.Rebind(); } } break; } }