I want to show the time not specific time, but range time, for example: 8:00- 10:00(please see the attached picture),
So I change the timpicker format:
RadTimePickerVisitTime.Culture = new System.Globalization.CultureInfo("en-US")
{
DateTimeFormat = new System.Globalization.DateTimeFormatInfo
{
ShortTimePattern = "HH:00-HH:00" , // In case of DisplayFormat="Short"
LongTimePattern = "HH:00-HH:00" // In case of DisplayFormat="long"
}
};
also I change the data show in timepicker:
protected void RadTimePickerVisitTime_ItemDataBound(object sender, TimePickerEventArgs e)
{
if ((e.Item.ItemType == ListItemType.Item)|| (e.Item.ItemType == ListItemType.AlternatingItem))
{
System.Data.DataRowView dataItem = (System.Data.DataRowView)e.Item.DataItem;
DateTime boundTime = (DateTime)dataItem.Row["Time"];
var first = boundTime.Hour + ":00-";
var second = boundTime.AddHours(2).Hour + ":00";
System.Globalization.CultureInfo culture = new System.Globalization.CultureInfo("en-US")
{
DateTimeFormat = new System.Globalization.DateTimeFormatInfo
{
ShortTimePattern = "HH:00-HH:00", // In case of DisplayFormat="Short"
LongTimePattern = "HH:00-HH:00" // In case of DisplayFormat="long"
}
};
boundTime = DateTime.Parse(first + second, culture);
}
}
But it not work, anyone can give me some suggestion, thanks a lot!!!!
So I change the timpicker format:
RadTimePickerVisitTime.Culture = new System.Globalization.CultureInfo("en-US")
{
DateTimeFormat = new System.Globalization.DateTimeFormatInfo
{
ShortTimePattern = "HH:00-HH:00" , // In case of DisplayFormat="Short"
LongTimePattern = "HH:00-HH:00" // In case of DisplayFormat="long"
}
};
protected void RadTimePickerVisitTime_ItemDataBound(object sender, TimePickerEventArgs e)
{
if ((e.Item.ItemType == ListItemType.Item)|| (e.Item.ItemType == ListItemType.AlternatingItem))
{
System.Data.DataRowView dataItem = (System.Data.DataRowView)e.Item.DataItem;
DateTime boundTime = (DateTime)dataItem.Row["Time"];
var first = boundTime.Hour + ":00-";
var second = boundTime.AddHours(2).Hour + ":00";
System.Globalization.CultureInfo culture = new System.Globalization.CultureInfo("en-US")
{
DateTimeFormat = new System.Globalization.DateTimeFormatInfo
{
ShortTimePattern = "HH:00-HH:00", // In case of DisplayFormat="Short"
LongTimePattern = "HH:00-HH:00" // In case of DisplayFormat="long"
}
};
boundTime = DateTime.Parse(first + second, culture);
}
}
But it not work, anyone can give me some suggestion, thanks a lot!!!!