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

RadGrid Filter

3 Answers 96 Views
Grid
This is a migrated thread and some comments may be shown as answers.
DEBAL
Top achievements
Rank 1
DEBAL asked on 21 Feb 2012, 03:43 PM
Hi Support ,

I'm using a rad grid in one of my business application , I can successfully show data in UI page (yes , I'm using simple asp.net application, no mvc/mvp pattern). In my certain Header column (for e.g. student name column, student address column etc......) I used Filter by using AllowFilteringByColumn="True"
1. now my first requirement is can I show in filter in textbox a default value like "--No Filter---" or "--Choose Filter ---" for user better understanding what they need to do with these filtering textboxes .

This is my First question , Hope can I able to explain , pl help me give your reply

3 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 22 Feb 2012, 05:05 AM
Hello,

Try the following code.
C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
 if (e.Item is GridFilteringItem)
 {
  GridFilteringItem item = (GridFilteringItem)e.Item;
  TextBox filter = (TextBox)item["UniqueName"].Controls[0];
  filter.Text = "--No filter--";
 }
}

-Shinu.
0
DEBAL
Top achievements
Rank 1
answered on 22 Feb 2012, 10:19 AM
Yes ,
It is working , now when the page load rad grid Filter text boxes show "--Filter--".    Now I want when  user click on Filter text box the word "--Filter--" should be disappear just like we did in ajax watermark textbox(but, be sure we are not using ajax, only telerik control radgrid).

Is it Possible in the below Code:

if (e.Item is GridFilteringItem)
 {
  GridFilteringItem item = (GridFilteringItem)e.Item;
  TextBox filter = (TextBox)item["UniqueName"].Controls[0];
   filter.Attributes.Add("onclick""ClearTextBoxScript");

.......

but not working, any idea pl ? Another one thing also , suppose user write in Filter Text box (for e.g. column name is Address) Ad.....
then after filtering and show the data in grid , the Filter column show the text box "-- Filter --"  but it should show "Ad" what user typed rather then "--Filter--"


0
Shinu
Top achievements
Rank 2
answered on 23 Feb 2012, 05:33 AM
Hello,

Check the following forum thread which discuss the same.
Text in Filter box in RadGrid

-Shinu.
Tags
Grid
Asked by
DEBAL
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
DEBAL
Top achievements
Rank 1
Share this question
or