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

Editing data before it's filtered

1 Answer 35 Views
Grid
This is a migrated thread and some comments may be shown as answers.
ryan
Top achievements
Rank 1
ryan asked on 29 Jun 2010, 04:36 PM
Hello,

I need to edit grid data in code before the server does filtering on it when the filter button is pressed.  The reason I need to do this is because text in my table has a space after it (which means the EndsWith filter doesn't work).  Anyone know the server-side event handler I can use to remove the whitespace before filtering is done on the data?  Or is there some other way to do this?

Thanks,

Ryan

1 Answer, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 30 Jun 2010, 01:12 PM
Hello ryan,

You can change the filter value instead:

protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
{
    if (e.CommandName == RadGrid.FilterCommandName && ((Pair)e.CommandArgument).Second.ToString() == "YourColumnUniqueName")
    {
        ((TextBox)(((Telerik.Web.UI.GridFilteringItem)(e.Item))["YourColumnUniqueName"].Controls[0])).Text = ((TextBox)(((Telerik.Web.UI.GridFilteringItem)(e.Item))["YourColumnUniqueName"].Controls[0])).Text + " ";
    }
}

Hope it helps.

Best wishes,
Tsvetoslav
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
ryan
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Share this question
or