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.