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.
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.