Filter with radcombo

2 posts, 0 answers
  1. Eric Klein
    Eric Klein avatar
    183 posts
    Member since:
    Aug 2009

    Posted 08 Jul 2011 Link to this post

    Is there any issues with the ability to filter using a filter template with a radcomb box in version 2009.2.826.35?
    I can load the grid, create the radcombo and fill it with values but when I select a value from the combo xo nothin happens.

    <telerik:RadGrid ID="RadGrid1" runat="server"  AllowPaging="True" EnableLinqExpressions ="false"
                        PageSize="25" AutoGenerateColumns="False" GridLines="None" AllowSorting="True" Width="100%"
                        AllowFilteringByColumn="true" AlternatingItemStyle-BackColor="#eeeeee" ShowStatusBar="True"
                        OnNeedDataSource="RadGrid1_NeedDataSource" OnItemDataBound="RadGrid1_ItemDataBound"
                        OnInsertCommand="RadGrid1_InsertCommand" OnUpdateCommand="RadGrid1_UpdateCommand" 
                        OnItemCreated="RadGrid1_ItemCreated">
                         <PagerStyle AlwaysVisible="true" Mode="NextPrevAndNumeric" />
                                <MasterTableView CommandItemDisplay="Top" DataKeyNames="AuditID" EditMode="InPlace">
                                    <AlternatingItemStyle BackColor="#EEEEEE"></AlternatingItemStyle>
                                    <Columns>
                                        <telerik:GridEditCommandColumn UniqueName="EditCommandColumn" HeaderStyle-Width="50px" />                                    
                                        <telerik:GridTemplateColumn HeaderText="Branch" SortExpression="" UniqueName="CRDBranchNumber"  HeaderStyle-Width="160px">                                  
                                           <ItemTemplate>
                                              <asp:Label runat="server" ID="lbCRDBranchNumber" Text='<%# Eval("CRDBranchNumber") %>' />
                                           </ItemTemplate>
                                           <EditItemTemplate>
                                              <telerik:RadComboBox ID="rcbCRDBranchNumber" DataTextField="CRDBranchNumber" DataValueField="CRDBranchNumber" runat="server" Width="115px" />
                                               <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="rcbCRDBranchNumber" ErrorMessage="*"
                                                     runat="server" ToolTip="Branch is Required" InitialValue="Select Branch"  ForeColor="Red" />
                                              <asp:Label runat="server" ID="ldID" Visible="false" Text='<%# Eval("CRDBranchNumber") %>' />
                                           </EditItemTemplate>
                                        </telerik:GridTemplateColumn>                                        
                                        <telerik:GridTemplateColumn HeaderText="Auditor" SortExpression="" UniqueName="Auditor"  HeaderStyle-Width="225px">
                                           <ItemTemplate>
                                              <asp:Label runat="server" ID="lbAuditor" Text='<%# Eval("AuditorName") %>' />
                                           </ItemTemplate>
                                           <EditItemTemplate>
                                              <telerik:RadComboBox ID="rcbAuditor" DataTextField="AuditorName" DataValueField="AuditorID" runat="server" Width="175px" />
                                               <asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="rcbAuditor" ErrorMessage="*"
                                                     runat="server" ToolTip="Auditor is Required" InitialValue="Select Auditor"  ForeColor="Red" />
                                              <asp:Label runat="server" ID="ldAuditorID" Visible="false" Text='<%# Eval("AuditorID") %>' />
                                           </EditItemTemplate>
                                        </telerik:GridTemplateColumn>                                                                                                
                                        <telerik:GridNumericColumn DataField="AuditYear" HeaderText="Audit Year" SortExpression="AuditYear" UniqueName="AuditYear" 
                                              DataType="System.Decimal" DataFormatString="{0:F0}" />                     
                                        <telerik:GridDateTimeColumn  SortExpression="ScheduledDate" DataField="ScheduledDate"
                                            HeaderText="Scheduled" DataType="System.DateTime" DataFormatString="{0:MM/dd/yyyy}"
                                            AllowFiltering="false" HeaderStyle-Width="100px" UniqueName="ScheduledDate" />
                                        <telerik:GridDateTimeColumn SortExpression="CompletedDate" DataField="CompletedDate"
                                            HeaderText="Completed" DataType="System.DateTime" DataFormatString="{0:MM/dd/yyyy}"
                                            AllowFiltering="false" HeaderStyle-Width="100px" UniqueName="CompletedDate" />                                        
                                        <telerik:GridTemplateColumn HeaderText="Status" SortExpression="" UniqueName="Status"  HeaderStyle-Width="195px">
                                           <FilterTemplate>
                                                <telerik:RadComboBox ID="rcbStatus" DataTextField="Status" DataValueField="Status"
                                                    AppendDataBoundItems="true" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("Status").CurrentFilterValue %>'
                                                    runat="server" AutoPostBack="true"  OnClientSelectedIndexChanged="TitleIndexChanged">
                                                        <Items>
                                                            <telerik:RadComboBoxItem Text="All" />
                                                        </Items>
                                                    </telerik:RadComboBox>
                                                    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
                                                        <script type="text/javascript">
                                                            function TitleIndexChanged(sender,args) {
                                                                var tableView=$find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                                                tableView.filter("Status",args.get_item().get_value(),"EqualTo");                                                            
                                                            }
                                                        </script>
                                                    </telerik:RadScriptBlock>
                                           </FilterTemplate>
                                           <ItemTemplate>
                                              <asp:Label runat="server" ID="lblStatus" Text='<%# Eval("Status") %>' />
                                           </ItemTemplate>
                                           <EditItemTemplate>
                                              <telerik:RadComboBox ID="rcbStatus" DataTextField="Status" DataValueField="AuditStatusID" runat="server" Width="150px" />
                                              <asp:RequiredFieldValidator ID="RequiredFieldValidator3" ControlToValidate="rcbStatus" ErrorMessage="*"
                                                     runat="server" ToolTip="Status is Required" InitialValue="Select Status"  ForeColor="Red" />
                                              <asp:Label runat="server" ID="lbAuditStatusID" Visible="false" Text='<%# Eval("AuditStatusID") %>' />
                                           </EditItemTemplate>
                                        </telerik:GridTemplateColumn>                                                                                
                                    </Columns>
                                    <EditFormSettings>
                                        <EditColumn InsertText="Insert Audit" UpdateText="Update Audit" UniqueName="EditCommandColumn1"
                                            CancelText="Cancel edit">
                                        </EditColumn>
                                    </EditFormSettings>
                                </MasterTableView>

    I can get this to work in another application but I am using 2009.3.1314.35.
  2. Eric Klein
    Eric Klein avatar
    183 posts
    Member since:
    Aug 2009

    Posted 08 Jul 2011 Link to this post

    I found th error I forgot to include the DataField in the TemplateColumn
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top