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

Label the filter row

4 Answers 94 Views
Grid
This is a migrated thread and some comments may be shown as answers.
John Davis
Top achievements
Rank 2
John Davis asked on 29 Mar 2009, 07:50 PM
Is there a way to put a label into the filter row to help a new user understand the purpose of this row?  Or some other way to label this row other than tooltip for the filter symbols?

Steve

4 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 30 Mar 2009, 04:04 AM
Hello Steve,

You can try out the following code to add a label to filter row for specific columns:
cs:
 protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    {       
      if (e.Item is GridFilteringItem) 
        { 
            GridFilteringItem filterItem = (GridFilteringItem)e.Item; 
            Label lbl = new Label(); 
            lbl.ID = "label"
            lbl.Text = "filter"
            filterItem["ColumnUniqueName"].Controls.AddAt(0, lbl); 
         } 
     } 

Thanks
Princy.
0
John Davis
Top achievements
Rank 2
answered on 30 Mar 2009, 12:29 PM
Princy,
Thank you. It works.  It is acceptable.

If there is any way to put the label with text "Filter:" in the left-most grid column (the one containing check boxes in my case), it would be better because it would suggest to the user that the whole row pertains to filters.

Steve
0
Princy
Top achievements
Rank 2
answered on 31 Mar 2009, 04:40 AM
Hello John,

If you want to add the label to the column containing the checkboxes then access the column using its UniqueName and then add the label to the filter row for that column. Check out the example below:
aspx:
 <telerik:GridTemplateColumn UniqueName="CheckColumn"
         <ItemTemplate> 
             <asp:CheckBox ID="CheckBox" Checked='<%#Eval("Checked") %>' runat="server" />               
         </ItemTemplate> 
 </telerik:GridTemplateColumn> 

cs:
 protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)  
    {        
      if (e.Item is GridFilteringItem)  
        {  
            GridFilteringItem filterItem = (GridFilteringItem)e.Item;  
            Label lbl = new Label();  
            lbl.ID = "label";  
            lbl.Text = "filter";  
            filterItem["CheckColumn"].Controls.AddAt(0, lbl);  
         }  
     }  

Thanks
Princy.
0
John Davis
Top achievements
Rank 2
answered on 31 Mar 2009, 11:05 AM
Princy, it works perfectly, thanks.
Tags
Grid
Asked by
John Davis
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
John Davis
Top achievements
Rank 2
Share this question
or