Hi,
I have a grid, that has a GridImageColumn. The imageUrl is working correctly, and on ItemDataBound I Clear the image out from some rows, so I am left with a grid that has some rows with an image and some without in the same column. My question is simply, is there a way to sort on that column?? I tried adding an invisible GridBoundColumn which I would populate with either a "1" or a "0" and set my sort expression to that column and set AllowSorting to true, but when I click on the column header I receive an error that says Cannot find column, so I think that's the wrong approach. See code below.
Any help will be greatly appreciated.
Thanks,
-Mike
I have a grid, that has a GridImageColumn. The imageUrl is working correctly, and on ItemDataBound I Clear the image out from some rows, so I am left with a grid that has some rows with an image and some without in the same column. My question is simply, is there a way to sort on that column?? I tried adding an invisible GridBoundColumn which I would populate with either a "1" or a "0" and set my sort expression to that column and set AllowSorting to true, but when I click on the column header I receive an error that says Cannot find column, so I think that's the wrong approach. See code below.
Any help will be greatly appreciated.
Thanks,
-Mike
| <ngc:NGCGrid ID="grdItems" runat="server" AllowPaging="True" AllowSorting="True" |
| AllowMultiRowSelection="True" GridLines="None" AutoGenerateColumns="False" PageSize="500" |
| OnNeedDataSource="grdItems_NeedSource" EnableViewState="true" AllowAutomaticDeletes="true" |
| OnItemCommand="grdItems_ItemCommand" OnItemDataBound="grdItems_ItemDataBound" |
| OnItemCreated="grdItems_ItemCreated" OnItemUpdated="grdItems_ItemUpdated" OnItemInserted="grdItems_ItemInserted" |
| OnItemDeleted="grdItems_ItemDeleted"> |
| <ClientSettings AllowKeyboardNavigation="True" > |
| <Scrolling AllowScroll="true" ScrollHeight="440px" UseStaticHeaders="true" /> |
| <Selecting AllowRowSelect="true" /> |
| </ClientSettings> |
| <MasterTableView CommandItemDisplay="Top" CommandItemSettings-AddNewRecordText="Add Item" |
| EditMode="InPlace" DataKeyNames="ITEM_ID"> |
| <CommandItemTemplate > |
| <div style="padding: 5px 5px;"> |
| <asp:LinkButton ID="LinkButton2" runat="server" CommandName="InitInsert" > |
| <img style="border:0px;vertical-align:middle;" alt="" src="../../App_Themes/SpidersTheme/Grid/AddRecord.gif" />Add new Item |
| </asp:LinkButton> |
| <asp:LinkButton ID="LinkButton1" OnClientClick="javascript:return confirm('Are you sure you want to delete all selected Items?')" |
| runat="server" CommandName="DeleteSelected"> |
| <img style="border:0px;vertical-align:middle;" alt="" src="../../App_Themes/SpidersTheme/Grid/Delete.gif" />Delete selected Items</asp:LinkButton> |
| </div> |
| </CommandItemTemplate> |
| <Columns> |
| <telerik:GridClientSelectColumn> |
| <HeaderStyle Width="10px" /> |
| <ItemStyle Width="10px" /> |
| </telerik:GridClientSelectColumn> |
| <telerik:GridEditCommandColumn ButtonType="ImageButton"> |
| <HeaderStyle Width="35px" /> |
| <ItemStyle Width="35px" /> |
| </telerik:GridEditCommandColumn> |
| <telerik:GridButtonColumn Text="Delete" CommandName="Delete" ButtonType="ImageButton" |
| ConfirmText="Are you sure you want to delete this item?"> |
| <HeaderStyle Width="10px" /> |
| <ItemStyle Width="10px" /> |
| </telerik:GridButtonColumn> |
| <telerik:GridImageColumn UniqueName="FilteredFlag" ImageUrl="../../Common/Images/green_flag_16x16.png" AllowSorting="true" |
| HeaderImageUrl="../../Common/Images/green_flag_16x16.png" SortExpression="FilterFlagOrder" > |
| <HeaderStyle Width="10px" /> |
| <ItemStyle Width="10px" /> |
| </telerik:GridImageColumn> |
| <telerik:GridBoundColumn UniqueName="FilterFlagOrder" Visible="true"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="NSN" HeaderText="NSN" UniqueName="NSN" ColumnEditorID="GridTextBoxColumnEditor1" > |
| <HeaderStyle Width="120px" /> |
| <ItemStyle Width="120px" /> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="ITEM_DESCRIPTION" HeaderText="Description" UniqueName="ITEM_DESCRIPTION" |
| ColumnEditorID="GridTextBoxColumnEditor2"> |
| <HeaderStyle Width="300px" /> |
| <ItemStyle Width="300px" /> |
| </telerik:GridBoundColumn> |
| <telerik:GridNumericColumn DataField="USAGE_FACTOR" HeaderText="Factor" UniqueName="USAGE_FACTOR" |
| ColumnEditorID="GridNumericColumnEditor1"> |
| <HeaderStyle Width="40px" /> |
| <ItemStyle Width="40px" /> |
| </telerik:GridNumericColumn> |
| <telerik:GridHyperLinkColumn Text="Search"> |
| </telerik:GridHyperLinkColumn> |
| </Columns> |
| </MasterTableView> |
| </ngc:NGCGrid> |
| <telerik:GridTextBoxColumnEditor ID="GridTextBoxColumnEditor1" runat="server" TextBoxStyle-Width="120px" /> |
| <telerik:GridTextBoxColumnEditor ID="GridTextBoxColumnEditor2" runat="server" TextBoxStyle-Width="300px" /> |
| <telerik:GridNumericColumnEditor ID="GridNumericColumnEditor1" runat="server" NumericTextBox-Width="40px" /> |