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

Filtering TemplateColumn with EditItemTemplate does not work

1 Answer 52 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Das
Top achievements
Rank 1
Das asked on 18 Feb 2009, 11:34 AM
Hi,

I have a grid with an editable column which needs to be enabled with filtering. I have set AllowFilteringByColumn=true for the grid and the DataField for the templatecolumn is also set. I have added the code below. Please let me know if I am missing something. The filtering is not working only for the grid with EditItemTemplate. Any help would be highly appreciated. Thanks.
 
<rad:RadGrid ID="rgDocuments" CssClass="ms-WPTitle" PageSize="10" AllowPaging="True"
                                    AllowSorting="True" runat="server" AllowFilteringByColumn="True" AutoGenerateColumns="False"
                                    OnNeedDataSource="rgDocuments_OnNeedDataSource" FilterMenu-CssClass="FilterMenuClass1"
                                    HorizontalAlign="NotSet" ShowGroupPanel="True" Skin="Default" GridLines="None"
                                    Width="100%" OnItemCreated="rgDocuments_OnItemCreated" OnDataBound="rgDocuments_DataBound"
                                    OnItemDataBound="rgDocuments_OnItemDataBound" AllowAutomaticDeletes="true" AllowAutomaticInserts="true"
                                    AllowAutomaticUpdates="true" OnUpdateCommand="rgDocuments_OnUpdateCommand">
                                    <ClientSettings AllowColumnsReorder="True" AllowDragToGroup="True">
                                        <Scrolling UseStaticHeaders="true" ScrollHeight="150px" AllowScroll="True" />
                                        <Resizing AllowColumnResize="True" AllowRowResize="True" />
                                    </ClientSettings>
                                    <MasterTableView GridLines="None" CommandItemDisplay="Top" Width="100%" EditMode="InPlace" DataKeyNames="FileType" AllowAutomaticUpdates="true">
                                        <EditFormSettings CaptionFormatString="Edit File Type {0}" ColumnNumber="6" CaptionDataField="FileType">
                                            <FormMainTableStyle BackColor="White" CellPadding="3" Width="100%" CellSpacing="0"></FormMainTableStyle>
                                            <FormTableStyle BackColor="White" CellPadding="2" Height="110px" CellSpacing="0"></FormTableStyle>
                                            <FormCaptionStyle CssClass="EditFormHeader"></FormCaptionStyle>
                                            <FormTableItemStyle Wrap="False"></FormTableItemStyle>
                                            <EditColumn CancelImageUrl="\Img\Cancel.gif" EditImageUrl="..\Img\Edit.gif" CancelText="Cancel edit"
                                                InsertText="Insert User" InsertImageUrl="..\Img\Save.gif" UniqueName="EditCommandColumn1"
                                                UpdateImageUrl="\Img\Save.gif" ButtonType="ImageButton" UpdateText="Update record">
                                            </EditColumn>
                                            <FormTableButtonRowStyle CssClass="EditFormButtonRow" HorizontalAlign="Right"></FormTableButtonRowStyle>
                                            <FormTableAlternatingItemStyle Wrap="False"></FormTableAlternatingItemStyle>
                                        </EditFormSettings>
                                        <CommandItemStyle HorizontalAlign="Right" />
                                        <CommandItemTemplate>
                                            <asp:LinkButton ID="lnkRefreshDocument" runat="server" CommandName="RebindGrid"><img style="border:0px" alt="" src="/wpresources/VesselAssurance/Images/Refresh.gif" /> Refresh </asp:LinkButton>
                                        </CommandItemTemplate>
                                        <Columns>
                                            <rad:GridEditCommandColumn UniqueName="EditCommandName" ButtonType="ImageButton">
                                                <ItemStyle Width="10%" HorizontalAlign="left" />
                                                <HeaderStyle HorizontalAlign="left" />
                                            </rad:GridEditCommandColumn>
                                            <rad:GridTemplateColumn UniqueName="TemplateColumn4" DataField="DocumentName" FilterListOptions="AllowAllFilters"
                                                HeaderText="Documents" HeaderStyle-HorizontalAlign="Left" SortExpression="DocumentName"
                                                Groupable="false" HeaderStyle-Width="25%">
                                                <ItemTemplate>
                                                    <a href="#" onclick="javascript:OpenDocumentsWindow('<%#DataBinder.Eval(Container.DataItem,"FilePath")%>','Vessels')">
                                                        <%#DataBinder.Eval(Container.DataItem, "DocumentName")%>
                                                    </a>
                                                </ItemTemplate>
                                                <HeaderTemplate>
                                                    Documents
                                                </HeaderTemplate>
                                            </rad:GridTemplateColumn>
                                            <rad:GridTemplateColumn UniqueName="FileType" DataField="FileType" FilterListOptions="AllowAllFilters"
                                                HeaderText="File Type" HeaderStyle-Width="25%" HeaderStyle-HorizontalAlign="Left" SortExpression="FileType">
                                                <ItemTemplate>
                                                    <%#DataBinder.Eval(Container.DataItem, "FileType")%>
                                                </ItemTemplate>
                                                <EditItemTemplate>
                                                    <asp:DropDownList ID="ddlFileType" runat="server"></asp:DropDownList>
                                                </EditItemTemplate>
                                                <HeaderTemplate>
                                                    File Type
                                                </HeaderTemplate>
                                            </rad:GridTemplateColumn>
                                            <rad:GridBoundColumn DataField="DateCreated" HeaderStyle-HorizontalAlign="Left" UniqueName="DateCreated"
                                                HeaderText="Created Date" HeaderStyle-Width="25%" ReadOnly="true">
                                            </rad:GridBoundColumn>
                                            <rad:GridTemplateColumn ItemStyle-HorizontalAlign="center" UniqueName="TemplateColumn2"
                                            AllowFiltering="false" Groupable="false" HeaderStyle-HorizontalAlign="Left" HeaderStyle-Width="10%">
                                            <ItemTemplate>
                                                <asp:Button ID="imgDelete" Style="position: relative; background:url(/RadControls/Grid/Skins/Default/Delete.gif) no-repeat; border:none 0px; width:15px; height:20px; cursor:pointer;" runat="server" UseSubmitBehavior="false" ToolTip="Del" OnClick="imgDocumentDelete_Click" />
                                            </ItemTemplate>
                                            </rad:GridTemplateColumn>
                                        </Columns>
                                        MasterTableView>
                                    <FilterMenu CssClass="FilterMenuClass1"></FilterMenu>
                                </rad:RadGrid>


The filtering works for all the other columns but not for the template column with EditTemplate. Please check this asap. Thanks.

1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 23 Feb 2009, 08:10 AM
Hi Das,

I tested the setup which you mentioned, and the control behaved as expected.
Attached to this message, you will find the code, which I used for testing.

Sincerely yours,
Yavor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Das
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or