This is a migrated thread and some comments may be shown as answers.

Radgrid Filter Not Working

1 Answer 211 Views
Grid
This is a migrated thread and some comments may be shown as answers.
kashir
Top achievements
Rank 1
kashir asked on 28 Mar 2016, 07:27 AM
I have a Radgrid which is binded in codebehind and containined in modalextender .Onload , grid show this error , UserNameTitleIndexChanged not defined ,it is defined in radcombobox but still not working
<telerik:RadGrid ID="GridConsultancy" runat="server" FilterMenu-CausesValidation="false" AllowFilteringByColumn="true" AllowPaging="false" AutoGenerateColumns="false" OnNeedDataSource="GridConsultancy_NeedDataSource"  EnableLinqExpressions="false">
                                       <GroupingSettings CaseSensitive="false" />
                                       <ClientSettings>
                                           <Scrolling AllowScroll="True" UseStaticHeaders="True"></Scrolling>
                                       </ClientSettings>
                                       <MasterTableView AllowFilteringByColumn="true" NoDetailRecordsText="No Data Present" AllowSorting="true" TableLayout="Fixed">
                                           <HeaderStyle Width="120" />
                                           <Columns>
                                               <telerik:GridTemplateColumn HeaderText="Sr No." HeaderStyle-Width="70" AllowFiltering="False" AutoPostBackOnFilter="true">
                                                   <ItemTemplate>
                                                       <asp:Label ID="lb_s" runat="server" Text="<%# Container.DataSetIndex+1 %>"></asp:Label>
                                                   </ItemTemplate>
                                               </telerik:GridTemplateColumn>
                                               <telerik:GridDateTimeColumn DataField="EntryDate" UniqueName="EntryDate" HeaderText="Entry Date" HeaderStyle-Width="110" FilterControlWidth="100px" DataType="System.DateTime"
                                                   SortExpression="EntryDate" EnableTimeIndependentFiltering="true" AutoPostBackOnFilter="true"
                                                   DataFormatString="{0:dd MMM yyyy}" CurrentFilterFunction="GreaterThanOrEqualTo">
                                               </telerik:GridDateTimeColumn>
                                                 <telerik:GridBoundColumn DataField="UserName" HeaderText="UserName" UniqueName="UserName"
                           FilterControlWidth="110" HeaderStyle-Width="120" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains"
                           ShowFilterIcon="false">
                           <FilterTemplate>
                               <telerik:RadComboBox ID="UserNameRadComboBoxTitle5" Width="110" Style="z-index: 10000001"
                                   runat="server" DataTextField="UserName" DataValueField="UserName"
                                   OnClientSelectedIndexChanged="UserNameTitleIndexChanged" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("UserName").CurrentFilterValue %>'>
                                   <Items>
                                       <telerik:RadComboBoxItem Text="Select" />
                                       <telerik:RadComboBoxItem Text="All" Value="" />
                                       <telerik:RadComboBoxItem Text="Tim" Value="Tim" />
                                       <telerik:RadComboBoxItem Text="Jeorge" Value="Jeorge" />
                                    
                                   </Items>
                               </telerik:RadComboBox>
                               <telerik:RadScriptBlock ID="UserNameRadScriptBlock" runat="server">
                                   <script type="text/javascript">
                                       function UserNameTitleIndexChanged(sender, args) {
                                           var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                                                   tableView.filter("UserName", args.get_item().get_value(), "Contains");
                                                               }
                                   </script>
                               </telerik:RadScriptBlock>
                           </FilterTemplate>
                       </telerik:GridBoundColumn>
                                           </Columns>
                                       </MasterTableView>
                                   </telerik:RadGrid>

1 Answer, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 29 Mar 2016, 10:10 AM
Hello Kashir,

I have examined the code and it seems correct. With that said, note that using AjaxControlToolkit can break some of the features in our controls. Would you remove the ModalPopupExtender and any reference to the Toolkit? Also, ensure that you are using the standard ScriptManager or RadScriptManager on the page and see if it makes a difference.

For additional information on the matter please examine the following thread:



Regards,
Viktor Tachev
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
Grid
Asked by
kashir
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question
or