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

Using FilterTemplate With AllowFiltering Property Set to False

1 Answer 36 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Siward Land
Top achievements
Rank 1
Siward Land asked on 30 Jun 2011, 05:32 PM

One of the GridTemplateColumn columns in my radgrid isn't populated by a database so its AllowFiltering property is set to false.  However, I want to put a loading gif where <FilterTemplate> puts its markup.

How do I do this?

<telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="true"  OnNeedDataSource="RadGrid1_NeedDataSource">
<Columns>
  <telerik:GridTemplateColumn UniqueName="MyCol1" AllowFiltering="false">
     <FilterTemplate>
           <!-- I want to put image here, but it doesn't display if AllowFilter=false -->
          <img src="images/loading.gif" />    
    </FilterTemplate>
     <ItemTemplate>
         <asp:Hyperlink ID="MyLink" runat="server" Text="MyLink"></asp:Hyperlink>
     </ItemTemplate>
  </telerik:GridTemplateColumn>
</Columns>
</telerik:RadGrid>

Any help is appreciated.

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 01 Jul 2011, 06:00 AM
Hello Siward,

One suggestion is to set AllowFiltering to true. Then hide the filter combobox and add an image control to the TemplateColumn in ItemCreated event.
Here is a sample code.

C#:
protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
{      
        if (e.Item is GridFilteringItem)
        {
            GridFilteringItem item = (GridFilteringItem)e.Item;
            item["MyCol1"].Controls.Clear();
            Image img = new Image();
            img.ImageUrl = "Images/rose.jpg"
            item["MyCol1"].Controls.Add(img);
        }            
}

Thanks,
Shinu.
Tags
Grid
Asked by
Siward Land
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or