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

Remove DateTimeColumn Filter Textbox

5 Answers 134 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 06 Dec 2013, 07:36 PM
Is there any way to hide the Filter Text box in a GridDateTimeColumn and only display the Calendar Icon and Filter Icon?

Thanks,
Mark

5 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 09 Dec 2013, 04:36 AM
Hi Mark,

You can set the FilterControlWidth="0px" and set the CSS class  to move the Calender towards a little right.

ASPX:
<telerik:GridDateTimeColumn DataField="OrderDate" UniqueName="OrderDate" HeaderText="OrderDate"
 CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" FilterControlWidth="0px">
</telerik:GridDateTimeColumn>

CSS:
<style type="text/css">
  .RadPicker_Default .rcCalPopup
  {
      margin-left: 18px !important;
  }
</style>

Thanks,
Princy
0
Mark
Top achievements
Rank 1
answered on 09 Dec 2013, 04:09 PM
Thanks for the reply.  Unfortunately, my entire solution is in code-behind.  I have tried setting the FilterControlWidth to 0px, but nothing has changed.  It would appear I cannot the columns.  I have implemented the google-like column filtering functionality, and I can alter those columns by adjusting the RadComboBox width, but standard GridBoundColumns and DateTime Columns I cannot alter the filter width or HeaderStyle.Width.

I have reviewed the following link and have tried both Fixed and Auto TableLayouts with no success.
http://www.telerik.com/community/forums/aspnet-ajax/grid/cannot-change-column-width.aspx

Any thoughts?

Thanks,
Mark
0
Mark
Top achievements
Rank 1
answered on 09 Dec 2013, 09:16 PM
Oh, I have ten of the google-style filtering custom columns, five standard GridBoundColumns and two DateTimeColumns.
0
Princy
Top achievements
Rank 2
answered on 10 Dec 2013, 04:32 AM
Hi Mark,

Please make sure you are creating the entire RadGrid from code behind. Please create RadGrid and its columns along with the events from Page_Init event. In the ItemCreated event you can set the FilterTextBox width.

C#:
protected void Page_Init(object source, System.EventArgs e)
{
 RadGrid1 = new RadGrid(); 
 RadGrid1.ItemCreated += new GridItemEventHandler(RadGrid1_ItemCreated);   
 this.PlaceHolder1.Controls.Add(RadGrid1);
}
void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
 if (e.Item is GridFilteringItem)
 {
     GridFilteringItem filteringItem = e.Item as GridFilteringItem;
     //set dimensions for the filter textbox 
     RadDatePicker box = filteringItem["DateColumnUniqueName"].Controls[0] as RadDatePicker;
     box.Width = Unit.Pixel(0);
 }
}

Thanks,
Princy
0
Mark
Top achievements
Rank 1
answered on 10 Dec 2013, 08:16 AM
Thanks again for the reply! 

Yes, it is all code behind, but it is in a SharePoint Web part.   I believe it can create it in the Web part's OnInit method, and hopefully that will fix the problem. 
Tags
Grid
Asked by
Mark
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Mark
Top achievements
Rank 1
Share this question
or