Hi All,
I am using GridDateTime Column in rad gridview and I want to change calender property of filter rad date time picker. I tried to do it like below way but its not working
Can anyone help me?.. Its urgent
Thanks in advance
Ruchi Jani
I am using GridDateTime Column in rad gridview and I want to change calender property of filter rad date time picker. I tried to do it like below way but its not working
protected void dgTest_ItemCreated(object sender, GridItemEventArgs e)
{
if (e.Item.ItemType == GridItemType.FilteringItem)
{
GridFilteringItem filterItem = (GridFilteringItem)e.Item;
RadDatePicker startDate = (RadDatePicker)filterItem["StartDate"].FindControl("RDIPFStartDate");
startDate.Calendar.ShowRowHeaders = false;
}
}
Can anyone help me?.. Its urgent
Thanks in advance
Ruchi Jani
11 Answers, 1 is accepted
0
Accepted
Hello Ruchi,
Thank you for contacting us.
Please note that the auto-generated pickers for filtering GridDateTimeColumns use SharedCalendar. Therefore, you will need to slightly modify your code:
Hope this helps. Please give it a try and let me know if it works for you.
Regards,
Eyup
Telerik
Thank you for contacting us.
Please note that the auto-generated pickers for filtering GridDateTimeColumns use SharedCalendar. Therefore, you will need to slightly modify your code:
protected
void
RadGrid1_ItemCreated(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridFilteringItem)
{
GridFilteringItem filterItem = e.Item
as
GridFilteringItem;
RadDatePicker picker = filterItem[
"StartDate"
].Controls[0]
as
RadDatePicker;
picker.SharedCalendar.ShowRowHeaders =
false
;
}
}
Hope this helps. Please give it a try and let me know if it works for you.
Regards,
Eyup
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0

THANGARAI
Top achievements
Rank 1
answered on 05 Nov 2013, 04:49 AM
How to set raddatepicker.calendar.ShowRowHeader=false for all raddatepicker throughout my website?
0

Princy
Top achievements
Rank 2
answered on 05 Nov 2013, 06:10 AM
Hi THANGARAI,
Please try the following code snippet to achieve your scenario.
Create a RadDatePickerAdapter.cs inside App_Code folder.
RadDatePickerAdapter.cs:
Create a default.browser inside App_Browsers folder.
default.browser:
ASPX:
Thanks,
Princy.
Please try the following code snippet to achieve your scenario.
Create a RadDatePickerAdapter.cs inside App_Code folder.
RadDatePickerAdapter.cs:
using
System;
using
System.Web.UI.Adapters;
using
Telerik.Web.UI;
/// <summary>
/// Summary description for RadDatePickerAdapter
/// </summary>
public
class
RadDatePickerAdapter : ControlAdapter
{
protected
override
void
OnLoad(EventArgs e)
{
var datepicker =
this
.Control
as
RadDatePicker;
if
(datepicker !=
null
)
{
datepicker.Calendar.ShowRowHeaders =
false
;
}
base
.OnLoad(e);
}
}
Create a default.browser inside App_Browsers folder.
default.browser:
<
browser
refID
=
"Default"
>
<
controlAdapters
>
<
adapter
controlType
=
"Telerik.Web.UI.RadDatePicker"
adapterType
=
"RadDatePickerAdapter"
/>
</
controlAdapters
>
</
browser
>
ASPX:
<
telerik:RadDatePicker
ID
=
"RadDatePicker1"
runat
=
"server"
>
</
telerik:RadDatePicker
>
Thanks,
Princy.
0

THANGARAI
Top achievements
Rank 1
answered on 05 Nov 2013, 09:51 AM
Hi Princy,
Thanks for your reply Its works great. But its not working for the RadDatePickers inside the RadGrid
Thanks for your reply Its works great. But its not working for the RadDatePickers inside the RadGrid
0

Princy
Top achievements
Rank 2
answered on 06 Nov 2013, 04:18 AM
Hi THANGARAI,
Unfortunately I couldn't replicate the issue at my end. Please have a look into the code snippet to hide the RowHeader of RadDatePicker which is inside the RadGrid. Please try to add the RadDatePickerAdapter.cs in App_Code folder and default.browser in App_Browsers folder.
ASPX:
Hope this will helps you.
Thanks,
Princy.
Unfortunately I couldn't replicate the issue at my end. Please have a look into the code snippet to hide the RowHeader of RadDatePicker which is inside the RadGrid. Please try to add the RadDatePickerAdapter.cs in App_Code folder and default.browser in App_Browsers folder.
ASPX:
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
DataSourceID
=
"SqlDataSource1"
AutoGenerateColumns
=
"false"
ShowFooter
=
"true"
>
<
MasterTableView
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"OrderID"
UniqueName
=
"OrderID"
HeaderText
=
"OrderID"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"CustomerID"
UniqueName
=
"CustomerID"
HeaderText
=
"CustomerID"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"ShipAddress"
UniqueName
=
"ShipAddress"
HeaderText
=
"ShipAddress"
>
</
telerik:GridBoundColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"DatePicker"
>
<
ItemTemplate
>
<
telerik:RadDatePicker
ID
=
"RadDatePicker1"
runat
=
"server"
>
</
telerik:RadDatePicker
>
<
telerik:RadDatePicker
ID
=
"RadDatePicker2"
runat
=
"server"
>
</
telerik:RadDatePicker
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
<
asp:SqlDataSource
ID
=
"SqlDataSource1"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="SELECT top 2 [OrderID], [CustomerID], [ShipAddress] FROM [Orders]">
</
asp:SqlDataSource
>
Hope this will helps you.
Thanks,
Princy.
0

THANGARAI
Top achievements
Rank 1
answered on 06 Nov 2013, 11:38 AM
Hi Princy,
Thanks for your reply.
Unfortunately we have many screens having RadGrid with gridbound column i cant change all those to grid item template columns. Please give some other solution which is feasible.
Please find my attachment.
Thanks for your reply.
Unfortunately we have many screens having RadGrid with gridbound column i cant change all those to grid item template columns. Please give some other solution which is feasible.
Please find my attachment.
0

Princy
Top achievements
Rank 2
answered on 07 Nov 2013, 07:05 AM
Hi THANGARAI,
I guess you are using GridDateTimeColumn then please try the following code snippet which works fine at my end. If you are using GridBoundColumn then the above solution works perfectly.
ASPX:
RadDatePickerAdapter.cs:
default.browser :
Hope this will helps you.
Thanks,
Princy.
I guess you are using GridDateTimeColumn then please try the following code snippet which works fine at my end. If you are using GridBoundColumn then the above solution works perfectly.
ASPX:
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
DataSourceID
=
"SqlDataSource1"
AutoGenerateColumns
=
"false"
ShowFooter
=
"true"
AllowFilteringByColumn
=
"true"
>
<
MasterTableView
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"OrderID"
UniqueName
=
"OrderID"
HeaderText
=
"OrderID"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"CustomerID"
UniqueName
=
"CustomerID"
HeaderText
=
"CustomerID"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"OrderDate"
UniqueName
=
"OrderDate"
HeaderText
=
"OrderDate"
DataType
=
"System.DateTime"
>
<
FilterTemplate
>
<
telerik:RadDatePicker
ID
=
"RadDatePicker1"
runat
=
"server"
>
</
telerik:RadDatePicker
>
</
FilterTemplate
>
</
telerik:GridBoundColumn
>
<
telerik:GridDateTimeColumn
DataField
=
"OrderDate"
UniqueName
=
"Date"
>
</
telerik:GridDateTimeColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
RadDatePickerAdapter.cs:
public
class
RadDatePickerAdapter : ControlAdapter
{
protected
override
void
OnLoad(EventArgs e)
{
var Calendar =
this
.Control
as
RadCalendar;
if
(Calendar !=
null
)
{
Calendar.ShowRowHeaders =
false
;
}
base
.OnLoad(e);
}
}
default.browser :
<
browser
refID
=
"Default"
>
<
controlAdapters
>
<
adapter
controlType
=
"Telerik.Web.UI.RadCalendar"
adapterType
=
"RadDatePickerAdapter"
/>
</
controlAdapters
>
</
browser
>
Hope this will helps you.
Thanks,
Princy.
0

THANGARAI
Top achievements
Rank 1
answered on 11 Nov 2013, 09:48 AM
Thank you Princy,
Its working great.Thanks a lot. It saved more time.
Its working great.Thanks a lot. It saved more time.
0

Ben
Top achievements
Rank 1
answered on 14 Apr 2015, 03:16 PM
Princy,
I am using a GridDateTimeColumn and having uses implementing this recommendation. Can you reply or email me with more specifics (benj9515@gmail.com)? Where should the "default.browser" code go? Do I need to make a new class for "RadDatePickerAdapter.cs"? Thanks
0
Hello Ben,
If you have difficulties implementing this approach, I suggest that you open a formal support ticket and provide detailed explanation about what exactly you want to achieve.
Regards,
Eyup
Telerik
If you have difficulties implementing this approach, I suggest that you open a formal support ticket and provide detailed explanation about what exactly you want to achieve.
Regards,
Eyup
Telerik
See What's Next in App Development. Register for TelerikNEXT.
0

Ben
Top achievements
Rank 1
answered on 17 Apr 2015, 03:33 PM
Thanks Eyup. I found the issue on my end. Solution works.