On Thu, Jul 29, 2010 at 7:08 AM, Gourav <[email protected]> wrote:
> Hi All,
>    I am asking same question fifth time but i didn't get solution of
> my query....pls anybody can help me..
>   Actually i wanna a calendar in which past date
> automatically disable.Currently i am using Calendar with J query but
> it not work with Ajax...If any one have some idea or code for this
> type of calendar then please share with me..
>
> i am also use Ajax calendar extender..its work good but in this past
> date not disable i put java script that user can't select lower
> date ....but i want to disable past date..and that should be able to
> work in update panel ..pls suggest me what can i do
> for this........I'll waiting for your reply.....
------------------------------------

This is the button click validation call for a pair of dates a user
has put into textboxes.

        protected int testDates()
        {
            int flag = 10;
            string jsCodetoRun = "";
            try
            {
                DateTime stdate = DateTime.Parse(txtStDate.Text.ToString());
                flag = flag - 1;
                DateTime enddate = DateTime.Parse(txtEndDate.Text.ToString());

                if (stdate > DateTime.Now.AddDays(-1))
                {
                    jsCodetoRun = "alert('Start should be less than
todays  date. ')";
                    SMfix(jsCodetoRun);
                }
                else if (stdate > enddate)
                {
                    jsCodetoRun = "alert('Start Date should be less
than End Date. ')";
                    SMfix(jsCodetoRun);
                }
                else if (enddate > DateTime.Now.AddDays(-1))
                {
                    jsCodetoRun = "alert('End Date should be less than
todays Date. ')";
                    SMfix(jsCodetoRun);

                }

                flag = 0;
            }
            catch (Exception ex)
            {
                if (flag== 10)
                    jsCodetoRun = "alert('The Start date is not a date')";
                else
                    jsCodetoRun = "alert('The End date is not a date')";

                SMfix(jsCodetoRun);

            }

            return flag;

I would refactor this to pull SMfix() out to the finally and run it
only if length  > 0

But I'm not going to ;->


-- 
Stephen Russell

Sr. Production Systems Programmer
CIMSgts

901.246-0159 cell

Reply via email to