1

I've had to replace my asp:Calendar control with another (Calendar/DatePicker) that also allows for year selection. After some searching, I found the Tigra Calendar; which seemed ideal because all I needed was a CSS link, JS source script, and an Input field added to my aspx page. It also had the advantage of offering client side operation so that it wasn't doing an autopostback on each click like the Calendar control was; I just had to add a "date" select button to send the page to the server.

The calendar appears to be working fine on my page, and I'm able to use the value as an SqlDataSource query parameter for a GridView as a FormParameter. The issues that I'm running into are that I also have a Chart that seems to need to already have a date "selected" on Page_Load, and I also want the selected date to remain visible in the Input field after clicking the select button.

With the Calendar control, I was able to do both with the following TextBox1 and Calendar1 statements in the code behind:

    namespace Mvc   
    {
        public partial class LoadSumByDate : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                if (!IsPostBack)
                {
                    TextBox1.Text = DateTime.Now.ToShortDateString();
                    Calendar1.SelectedDate = DateTime.Now;
                }

            }

However, an Input (tag?) apparently doesn't work the same as a Control. I've tried doing similar as above for my SelDate Input, using a "value" in the input statement itself, etc., but without any success. The only documentation that Tigra has seems to be for the Tigra Calendar Pro; which basically says that it can be done, just not how to do it;(and I don't know if it is in the Pro version only). Also, my days of searches haven't returned anything useful/helpful.

Here's my ASPX page code with the CSS link, JS script source, Input, and Button control:

    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <link href="StyleSheet.css" rel="stylesheet" type="text/css"/>

        <!-- link calendar resources -->
        <link rel="stylesheet" type="text/css" href="tcal.css" />
        <script type="text/javascript" src="tcal.js"></script> 
    </head>

    <body>
        <form action="#" id="form1" runat="server">
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>

            Date 
            <input id="SelDate" name="SelDate" class="tcal" type="text" />
            <asp:Button id="SelButton" runat="server" Text="Select" OnClick="Timer2_Tick" />

If anyone has any idea on how to initialize the calendar with today's date, and retain the date in the Input field, that information would be most appreciated. If not, links to alternate solutions are welcome too.

0 Answers0