3 Answers, 1 is accepted
0
Hi Ivan,
You could hook up the ItemDataBound event and in it you should check whether the item is TreeListEditFormItem. After that cast the e.Item as TreeListEditFormItem. Next use the FindControl method to find the desired control. After that you receive all the functionality of the Calendar.
The illustrated approach, could be used to find any controls within TreeListEditFormItem.
Regards,
Andrey
the Telerik team
You could hook up the ItemDataBound event and in it you should check whether the item is TreeListEditFormItem. After that cast the e.Item as TreeListEditFormItem. Next use the FindControl method to find the desired control. After that you receive all the functionality of the Calendar.
protected void RadTreeList1_ItemDataBound(object sender, TreeListItemDataBoundEventArgs e)
{
if
(e.Item is TreeListEditFormItem)
{
TreeListEditFormItem editedItem = e.Item as TreeListEditFormItem;
RadCalendar rCalendar = (RadCalendar)editedItem.FindControl(
"RadCalendar1"
);
rCalendar.DateTimeFormat.CalendarWeekRule = System.Globalization.CalendarWeekRule.FirstFourDayWeek;
}
}
The illustrated approach, could be used to find any controls within TreeListEditFormItem.
Regards,
Andrey
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>
0
Ivan
Top achievements
Rank 1
answered on 08 Sep 2011, 02:51 PM
I found this way but I have a read only exception please can you help me
if
(e.Column.DataField ==
"StartDate"
)
{
e.CustomEditorInitializer =
new
TreeListCreateCustomEditorDelegate(
delegate
{
TreeListDateTimeColumnEditor stDate =
new
TreeListDateTimeColumnEditor(e.Column);
stDate.DatePickerControl.Culture.DateTimeFormat.CalendarWeekRule = System.Globalization.CalendarWeekRule.FirstFourDayWeek;
return
stDate;
});
}
0
Hello Ivan,
Thank you for getting back to us.
Please check the following code and see whether it is suitable for your scenario.
Although if you prefer the other approach, then you could use the following code:
Do not hesitate to contact us again, if you have more questions.
Greetings,
Andrey
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Thank you for getting back to us.
Please check the following code and see whether it is suitable for your scenario.
protected
void
RadTreeList1_ItemDataBound(
object
sender, TreeListItemDataBoundEventArgs e)
{
if
(e.Item
is
TreeListEditFormItem)
{
TreeListEditFormItem editedItem = e.Item
as
TreeListEditFormItem;
RadDatePicker radDatePicker = (RadDatePicker)editedItem.FindControl(
"RadDatePicker1"
);
var calendar = radDatePicker.Calendar;
System.Globalization.CultureInfo c =
new
System.Globalization.CultureInfo(calendar.CultureInfo.ToString());
c.DateTimeFormat.CalendarWeekRule = System.Globalization.CalendarWeekRule.FirstFullWeek;
calendar.CultureInfo = c;
}
}
Although if you prefer the other approach, then you could use the following code:
if
(e.Column.DataField ==
"StartDate"
)
{
e.CustomEditorInitializer =
new
TreeListCreateCustomEditorDelegate(
delegate
{
TreeListDateTimeColumnEditor stDate =
new
TreeListDateTimeColumnEditor(e.Column);
var calendar = stDate.DatePickerControl.Calendar;
System.Globalization.CultureInfo c =
new
System.Globalization.CultureInfo(calendar.CultureInfo.ToString());
c.DateTimeFormat.CalendarWeekRule = System.Globalization.CalendarWeekRule.FirstFullWeek;
calendar.CultureInfo = c;
return
stDate;
});
}
Do not hesitate to contact us again, if you have more questions.
Greetings,
Andrey
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.