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

Dynamically create Filter template

2 Answers 116 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kris
Top achievements
Rank 1
Kris asked on 20 Jan 2011, 05:06 PM
I have a grid with a dynamic datasource (i.e. the 1st 5 columns are the same, but depending on user input, the ending columns differ), and am trying to put a between date filter and drop down filter for a couple of the static columns. This datasource is filled by a stored procedure. So what I need to accomplish is to create a filter template dynamically on the static columns.

So is it possible to build and apply a templatefilter from the code-behind?

Here's my grid code:
 
<telerik:RadGrid
    AutoGenerateColumns="true"
    ID="googleEarthAnalyticalGrid"
    OnNeedDataSource="grd_NeedDataSource"
    AllowFilteringByColumn="True"
    AllowSorting="True"
    DataKeyNames="PropertyID, SampleDate"
    ClientDataKeyNames="PropertyID, SampleDate"
    PageSize="6"
    ShowFooter="True"
    AllowPaging="True"
    runat="server"
    GridLines="Both"
    Skin="Windows7"
    onitemcommand="grd_ItemCommand"
    onitemcreated="grd_ItemCreated"
    GroupingSettings-CaseSensitive="false"
    oncolumncreated="grid_ColumnCreated" EnableLinqExpressions="true"
    ondatabound="googleEarthAnalyticalGrid_DataBound"
    oninit="googleEarthAnalyticalGrid_Init"
    onitemdatabound="googleEarthAnalyticalGrid_ItemDataBound1">
    <PagerStyle Mode="NextPrevAndNumeric" AlwaysVisible="true" />
        <MasterTableView AutoGenerateColumns="true" EditMode="InPlace" AllowFilteringByColumn="True"
            ShowFooter="True" DataKeyNames="PropertyID, SampleDate" ClientDataKeyNames="PropertyID, SampleDate" >       
        <CommandItemSettings ShowExportToExcelButton="true" />
        </MasterTableView>
</telerik:RadGrid>

2 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 25 Jan 2011, 12:57 PM
Hi Kris,

Try using the solution provided here in the Page_Load or Page_PreRender event.


All the best,
Maria Ilieva
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Maria Ilieva
Telerik team
answered on 25 Jan 2011, 12:57 PM
Hi Kris,

Try using the solution provided here in the Page_Load or Page_PreRender event.


All the best,
Maria Ilieva
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Grid
Asked by
Kris
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or