C1Calendar PopupMode

Posted by: jnekula on 10 September 2017, 11:47 am EST

  • Posted 10 September 2017, 11:47 am EST


    I have some troubles setting up a popup calendar. Following the instructions in the manual (http://www.componentone.com/newimages/Products/Documentation/Wijmo.Calendar.pdf) I created:

    <script type="text/javascript">

    $(function ()
    $("#<%=tbPlatnostOd.ClientID %>").click(function () { $("#<%=calPlatnostOd.ClientID %>").c1calendar("popup", { of: $("#<%=tbPlatnostOd.ClientID %>"), offset: '0 2' }); })

    function SelectDate()
    var selDate = $(this).calPlatnostOd("getSelectedDate");
    if (!!selDate) $("#<%=tbPlatnostOd.ClientID %>").val(selDate.toDateString());


    <div class="column_C35 bottom_tab">
    <asp:TextBox ID="tbPlatnostOd" CssClass="column_A10 textbox" runat="server" />
    <wijmo:C1Calendar ID="calPlatnostOd" runat="server" PopupMode="True" OnClientSelectedDatesChanged="SelectDate" >

    The problem is that when I click inside the textbox the calendar pops out fine, but when I select a date nothing gets written to the textbox. Any ideas on what might be wrong?

    Thank you.
  • Replied 10 September 2017, 11:47 am EST

    There is a syntax error in your code. You need to replace calPlatnostOd with c1calendar in the line
    var selDate = $(this).calPlatnostOd("getSelectedDate");

    It should be :
    var selDate = $(this).c1calendar("getSelectedDate");

  • Replied 10 September 2017, 11:47 am EST

    That fixed it. I was too Ctrl+C/V happy again :)

    But I ran into another issue. After selecting a date the textbox shows the selected date. But when I access the textbox from codebehind the textbox.Text property is "". It seems that the calendar value dos not get posted back to the server. Any ideas on a fix?

    Thank you
  • Replied 10 September 2017, 11:47 am EST

    OK, found the problem. Apparently the textbox is not using the viewstate to send its value, but rather the request header. And when I set the ReadOnly property to true the values does not get send. I fixed the problem by removing the ReadOnly property and setting it from PageLoad like TextBox.Attributes.Add("readonly", "readonly");
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels