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

Grid Filtering XML Datasource

1 Answer 63 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mohammed
Top achievements
Rank 1
Mohammed asked on 19 Jan 2009, 11:14 AM

Hi,
        I have some problem with Telerik Grid Control Filtering functionality.

        I have given XMLDatasource but i was trying i all the ways but no column is filtering.

        Please anyone help me out.

         For your reference please find the following code.


 

 

<asp:ScriptManager ID="ScriptManager1" runat="server" />

 

 

 

 

 

<telerik:RadGrid ID="RadGrid1" AllowFilteringByColumn="true" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource" Skin="Office2007"

 

 

 

 

 

OnColumnCreated="RadGrid1_ColumnCreated" OnItemCreated="RadGrid1_ItemCreated">

 

 

 

 

 

</telerik:RadGrid>

 

 

<asp:XmlDataSource ID="XmlDataSource1" runat="server" ></asp:XmlDataSource>

 

 

 


 

 

protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e)

 

{

XmlDataSource1.DataFile =

"~/Resources/SbtInternalDir.xml";

 

RadGrid1.DataSource = XmlDataSource1;

}

 


 

 

protected void RadGrid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e)

 

{

 

if (e.Column.IsBoundToFieldName("ID"))

 

{

e.Column.CurrentFilterFunction =

GridKnownFunction.EqualTo;

 

e.Column.AutoPostBackOnFilter =

true;

 

}

 

if (e.Column.IsBoundToFieldName("Name"))

 

{

e.Column.CurrentFilterFunction =

GridKnownFunction.Contains;

 

e.Column.AutoPostBackOnFilter =

true;

 

}

}

 

protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)

 

{

 

if (e.Item is GridFilteringItem)

 

{

 

foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns)

 

{

 

Control filterImage = e.Item.FindControl(String.Format("Filter_{0}", column.UniqueName));

 

 

if (filterImage != null)

 

{

filterImage.Visible =

false;

 

}

}

}

}

Looking forward for quick reply from Professional Telerik Team.

With Regards,

Mohammed

1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 22 Jan 2009, 07:14 AM
Hi Mohammed,

I reviewed the code, and it looks correct.
If the issue persists, you can open a formal support ticket, and send us a small project., containing your datasource, for additional testing.

Best wishes,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Mohammed
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or