Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
425
value label displays wrong value
posted

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.

 

<%@ Page Language="VB" %>

<%@ Register assembly="Infragistics35.Web.v8.2, Version=8.2.20082.1000, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.Web.UI.EditorControls" tagprefix="cc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

Protected Sub TestWebSlider_Load(ByVal sender As Object, ByVal e As System.EventArgs)

 

'doesn't work

Dim startdate As New DateTime(2006, 2, 2)Dim enddate As New DateTime(2006, 3, 1)

 

'works

'Dim startdate As New DateTime(2006, 1, 2)

'Dim enddate As New DateTime(2006, 2, 20)

 

'works

'Dim startdate As New DateTime(2006, 3, 2)

'Dim enddate As New DateTime(2006, 3, 20)

 

Me.WebSlider1.MinValue = startdate

Me.WebSlider1.MaxValue = enddate

Me.WebSlider1.Value = startdate

End Sub

</script>

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title></title>

</head>

<body>

<form id="form1" runat="server" onload="TestWebSlider_Load">

 

<asp:ScriptManager ID="ScriptManager1" runat="server">

</asp:ScriptManager>

 

<div>

 

<cc1:WebSlider ID="WebSlider1" runat="server"

ValueType="DateTime">

<ValueLabel Location="RightOrBottom" />

</cc1:WebSlider>

 

 

 

</div>

</form>

</body>

</html>

 

 

Parents
No Data
Reply
  • 24497
    posted

    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.

    <style type="text/css">
     .lbl{width:60px;}
    </style>

    <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>

Children