I'm using a webslider with a valuetype=datetime. I have the valuelabel set to display on RightOrBottom. The valuelabel displays wrong for certain dates. The control has the correct values when access from the server so it is just a client side display problem. Below is the code to reproduce the problem. It seems any dates in Feb of 2006 don't work.
<%@ Register assembly="Infragistics35.Web.v8.2, Version=8.2.20082.1000, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.Web.UI.EditorControls" tagprefix="cc1" %>
<script runat="server">
'doesn't work
'works
'Dim startdate As New DateTime(2006, 1, 2)
'Dim enddate As New DateTime(2006, 2, 20)
'Dim startdate As New DateTime(2006, 3, 2)
'Dim enddate As New DateTime(2006, 3, 20)
Me.WebSlider1.MaxValue = enddate
End Sub
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
</head>
<body>
<form id="form1" runat="server" onload="TestWebSlider_Load">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
ValueType="DateTime">
<ValueLabel Location="RightOrBottom" />
</cc1:WebSlider>
</div>
</body>
</html>
Hi,
Default format for value-label depends on range of dates and may include/not-include, day, month, year, hours, minutes, etc. To customize it, application should process ClientEvent.FormatValueLabel.
Example below shows how to process that event, customize tickmark labels and increase width of value label.
<script type="text/javascript">function formatValue(slider, evtArgs){ var val = evtArgs.get_value(); var year = val.getFullYear() % 100; if(year < 10) year = '0' + year; var lbl = (val.getMonth() + 1) + '/' + val.getDate() + '/' + year; evtArgs.set_label(lbl);}</script>
<ig:WebSlider ID="WebSlider1" runat="server" ValueType="DateTime"> <ClientEvents FormatValueLabel="formatValue" /> <ValueLabel Location="RightOrBottom" CssClass="lbl" /> <Tickmarks LabelFormatString="M/d/yy"></Tickmarks></ig:WebSlider>
var val = evtArgs.get_value(); //this line can obtain the value for the frist slider.
If you are using dual slider how to obtain the value for the secondary slider.
The name of function is get_otherValue(). I think that class is documented. You also may set a break point in handler (like type-in a line "debugger;") and check members of evtArgs.
If you want the slider to represent times, you need to set the the ValueType property to be either DateTime or Timespan. I'm currently using datetime because I'm just using the date and not the time part. If you don't want the date to be displayed then just change the formatting using the clientside event.
Hope that helps.
Eric
ServerSide Properties
Me
.WebSlider1.ValueType = Infragistics.Web.UI.EditorControls.SliderValueType.DateTime
Me.WebSlider1.MinValue = _Schedule.ScheduleSetup.StartDate
Me.WebSlider1.MaxValue = _Schedule.ScheduleSetup.EndDate
ClientSide formatting
<
ClientEvents FormatValueLabel="FormatWebSliderValueLabel" />
function
FormatWebSliderValueLabel(args) {
args._dateFormat = "M/d/yy";
}
hi ,
U r Post is really very useful , thanks for that .
I want to search metods to get hours and minutes .
and display range of time for first and second thumb . how can i get all the method names required ?