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

Resize Column and Hide Filter Textbox

1 Answer 174 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Shawn
Top achievements
Rank 1
Shawn asked on 26 Jan 2009, 10:14 PM
I have a grid that is a little too large for my page so I want to hide a few of the filter textboxes, is this possible?  I have a checkbox template column on the grid but since I allow filtering the textbox displays for that columns too and I don't want it to.

I also have columns like "State" and "Zipcode" that I want to shrink the filter text box to save room, is there a way to do that?

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 27 Jan 2009, 04:55 AM
Hi Shawn,

Try the following code snippet to set the size of the filter textbox.

CS:
protected void RadGrid1_ItemCreated(object  sender, GridItemEventArgs e) 
 if (e.Item is GridFilteringItem) 
 { 
   GridFilteringItem filteringItem = e.Item as GridFilteringItem; 
   //set dimensions for the filter textbox 
   TextBox box1 = filteringItem["State"].Controls[0] as TextBox; 
   TextBox box2 = filteringItem["Zipcode"].Controls[0] as TextBox; 
   box1.Width = Unit.Pixel(30); 
   box2.Width = Unit.Pixel(30); 
  
 } 
}  

You can remove filtering for GridTemplateColumn by setting AllowFiltering property to false.

ASPX:
 <telerik:GridTemplateColumn UniqueName="TempCol" AllowFiltering="false"  HeaderText="TempCol"  > 
        <ItemTemplate> 
            <asp:CheckBox ID="CheckBox1" runat="server" /> 
        </ItemTemplate> 
 </telerik:GridTemplateColumn> 


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