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

Grid Column Filtering

1 Answer 21 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Lubna Ansari
Top achievements
Rank 1
Lubna Ansari asked on 17 Aug 2010, 10:15 AM
Hi,

I'm binding a rag grid to the data source on aspx page except one column AGE which I'm calculating in code behind. The data binding works fine but filtering doesn't work for that column. Below is my code.

<

 

telerik:RadGrid AutoGenerateColumns="false" ID="rgrdPatient" DataSourceID="dsUINList"

 

 

AllowFilteringByColumn="True" AllowSorting="True"  ShowFooter="True" AllowPaging="True" runat="server"

 

 

OnItemDataBound="rgrdPatient_ItemDataBound" AllowMultiRowSelection="true">

 

<

 

MasterTableView AutoGenerateColumns="false" EditMode="InPlace" AllowFilteringByColumn="True" DataKeyNames="ID" >

 

 

<Columns>

 

 

<telerik:GridBoundColumn DataField="DOB" HeaderText="Age" SortExpression="DOB" CurrentFilterFunction="EqualTo"

 

 

UniqueName="DOB" AutoPostBackOnFilter="true" ShowFilterIcon="true" FilterControlWidth="30px" DataType="System.Int16">

 

 

<HeaderStyle HorizontalAlign="Center" Width="30px" />

 

 

<ItemStyle HorizontalAlign="Center" Width="30px"/>

 

 

</telerik:GridBoundColumn>

 

</

 

Columns>

 

 

 

</MasterTableView>

</

 

telerik:RadGrid>


 

 

protected void rgrdPatient_ItemDataBound(object sender, GridItemEventArgs e)

 

{


 

string Age = item["DOB"].Text;

 

 

DateTime dtAge = Convert.ToDateTime(Age);

 

Age =

GeneralFunction.CalculateAge(dtAge.Year.ToString(), dtAge.Month.ToString(), dtAge.Day.ToString()).ToString();

 

item[

"DOB"].Text = Age;

 


}

Regards,
Lubna.

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 19 Aug 2010, 03:54 PM
Hi Lubna,

Please note that mixing the both declarative and programmatic ways for creating RadGrid is not supported scenario. Thus I suggest you to create all columns declaratively and verify if any issues appear.


Maria Ilieva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Lubna Ansari
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or