I have RadGrid with filters. I need to change style/filterbutton to show user which filter is currently applied.
I need to change when is fired OnItemCommand.
if(e.CommandName == RadGrid.FilterCommandName)
{ Change style to current filter.}
Actually this information is insufficient for me.
I need to change when is fired OnItemCommand.
if(e.CommandName == RadGrid.FilterCommandName)
{ Change style to current filter.}
Actually this information is insufficient for me.
5 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 16 Jun 2008, 10:33 AM
Hi Martin,
Go through the following help document link.
Setting filter textbox dimensions/changing default filter image
Thanks
Princy.
Go through the following help document link.
Setting filter textbox dimensions/changing default filter image
Thanks
Princy.
0
Martin
Top achievements
Rank 1
answered on 19 Jun 2008, 11:46 AM
Hi Princy,
Thanks for your replay. How ever I think it is not exactly what I expected. I need to change style during filtering. So as i filter by some column I need to change style of textbox/image which is filter is used.
OnItemCmmand is not working, so style is not change. At beggining I try to change BackColor of textbox.
Thanks for your replay. How ever I think it is not exactly what I expected. I need to change style during filtering. So as i filter by some column I need to change style of textbox/image which is filter is used.
OnItemCmmand is not working, so style is not change. At beggining I try to change BackColor of textbox.
0
Martin
Top achievements
Rank 1
answered on 20 Jun 2008, 09:30 AM
If there is no answer I suppose to think that it is impossible?
0
Princy
Top achievements
Rank 2
answered on 20 Jun 2008, 10:54 AM
Hi Martin,
Give a try the following code snippet.
CS:
Thanks
Princy.
Give a try the following code snippet.
CS:
| protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) |
| { |
| if (e.CommandName == RadGrid.FilterCommandName) |
| { |
| GridFilteringItem filter = (GridFilteringItem)e.Item; |
| string strtxt = ((System.Web.UI.Pair)(e.CommandArgument)).Second.ToString(); |
| TextBox txtbx = (TextBox)filter[strtxt].Controls[0]; |
| txtbx.BackColor = System.Drawing.Color.Red; |
| } |
| } |
Thanks
Princy.
0
Martin
Top achievements
Rank 1
answered on 20 Jun 2008, 11:25 AM
Hi Princy,
This is my code :
So it doesn't work. BindGridView() i rebind datasource.
This is my code :
| protected void OnItemCommand_Click(object sender, GridCommandEventArgs e) |
| { |
| if (e.CommandName == RadGrid.FilterCommandName) |
| { |
| Pair filter = (Pair)e.CommandArgument; |
| GridFilteringItem filterItem = e.Item as GridFilteringItem; |
| TextBox filterTextBox = (TextBox)(filterItem)[filter.Second.ToString()].Controls[0]; |
| filterTextBox.BackColor = System.Drawing.Color.Red; |
| string filterPattern = filterTextBox.Text; |
| if (filter.First.ToString() != "NoFilter") |
| { |
| BindGridView(filter.Second.ToString(), filterPattern); |
| } |
| else |
| { |
| BindGridView(filter.Second.ToString(), string.Empty); |
| } |
| } |
| } |
So it doesn't work. BindGridView() i rebind datasource.