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

RadGrid GridTemplateColumn FilterMenu Alignment

3 Answers 356 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mahesh Babu
Top achievements
Rank 1
Mahesh Babu asked on 26 Aug 2009, 11:25 AM
Hi,

I have a radgrid to which I am adding columns as GridTemplateColumns which can be aligned in some order( number-right, date-left) . My radgrid supports column filtering. My issue is when I switch on filtering on columns, the filter textbox and image is not aligned with respect to the column alignment.

is there any way to set alignment to filter textbox and image??

Thanks,
Mahesh

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 27 Aug 2009, 08:37 AM
Hello Mahesh,

You can access the filtering item for the required column and customize it as shown below:
c#:
  protected void RadGrid_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
    { 
        if (e.Item is GridFilteringItem) 
        { 
            GridFilteringItem filterItem = (GridFilteringItem)e.Item; 
            filterItem["TemplateColumnUniqueName"].HorizontalAlign = HorizontalAlign.Right;  
            
        } 
    } 

Thanks
Princy.
0
Nirav Nayak
Top achievements
Rank 1
answered on 06 May 2010, 06:49 AM
I have auto generated columns in my RadGrid.

So how can i access the filteritem as i don't have "TempleteColumnUniqeName" in ItemDataBound event.

I am not able to set the filter control alignment for autogenerated columns.



0
Shinu
Top achievements
Rank 2
answered on 06 May 2010, 11:08 AM
Hello Nirav,

You can try the following code snippet to set the filter control alignment for autogenerated columns.

C#:





 protected
 void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
    { 
        if (e.Item is GridFilteringItem) 
        { 
            GridFilteringItem filterItem = (GridFilteringItem)e.Item; 
            foreach (GridColumn column in RadGrid1.MasterTableView.AutoGeneratedColumns) 
            { 
                string s = column.UniqueName; 
                filterItem[s].HorizontalAlign = HorizontalAlign.Right; 
            } 
       }  
    } 

Regards,
Shinu.
Tags
Grid
Asked by
Mahesh Babu
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Nirav Nayak
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or