Welcome Guest Search | Active Topics | Sign In | Register

DatePicker - disable Options
Mackin
Posted: Wednesday, September 14, 2011 6:26:09 PM
Rank: Advanced Member
Groups: Member

Joined: 6/1/2007
Posts: 31
We are having some difficulty disabling the DatePicker control and setting a "grayed out" effect. Is this supported?

What we are trying to achieve is the ability to clear the date and show a "grayed out" appearance. Or just disable the datepicker and show the grayed out effect and prevent date selection in either case.

What is happening, is when the date is cleared out, and the DisableTextBox property is set to true, the position of the image button shifts to the left where the textbox was before disabling.

Disabling the DatePicker should prevent the user from selecting any date when disabled, but should still show the textbox ( with a date, or cleared ) when disabled.

Here is the oncheckchaged handler for the checkbox. There is another method that just clears all form values.

Thanks,

Code: C#
protected void ui_chk_AnaStatus_OnCheckedChanged(Object sender, EventArgs e)
{
        if (ui_chk_AnaStatus.Checked)
        {
            DateStart.DisableTextBox = true;
            DateEnd.DisableTextBox = true;

            DateStart.Enabled = false;
            DateEnd.Enabled = false;

            Date_Set();  // set the date to current days date
            DateEnd.CssClass = "Test";
            DateStart.BackColor = System.Drawing.Color.Gray;
            DateEnd.ForeColor = System.Drawing.Color.Gray;
        }
        else
        {
            DateStart.DisableTextBox = false;
            DateEnd.DisableTextBox = false;
            DateStart.Enabled = true;
            DateEnd.Enabled = true;     
        }
}


eo_support
Posted: Wednesday, September 14, 2011 7:46:41 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

To avoid image button shifting positions, put a fixed width (for example, "width:100px") in your PickerStyle. You will also want to set the DatePicker's PopupTrigger to "TextBoxFocus". Otherwise clicking the date text will open up the popup even if the DatePicker is disabled.

Thanks!



You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.