This is a migrated thread and some comments may be shown as answers.

[Solved] RadDatePicker not displayed correctly after postback in hidden state

2 Answers 324 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Olav
Top achievements
Rank 1
Olav asked on 07 May 2009, 04:31 PM
I have a problem with a web page I am developing. Some of the controls on the page are only visible after the user press a button.
One of these is a RadDatePicker.
If the user does some action on the page that triggers a postback when the RadDatePicker is hidden, and then press the button to display it again, then the image on the RadDatePicker is not shown. Instead there will be a text: "Open the calendar popup".

The following sample code demonstrates the problem:
aspx. file:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="CalendarTest._Default" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="rad" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" ScriptMode="Release" />
    <div>
        <asp:Button ID="Button1" runat="server" Text="Button" />
    </div>
    <div>
        <rad:RadAjaxManagerProxy runat="server">
            <AjaxSettings>
                <rad:AjaxSetting AjaxControlID="btnToggleSearchMode" EventName="Click">
                    <UpdatedControls>
                        <rad:AjaxUpdatedControl ControlID="picker" LoadingPanelID="LoadingPanel1" />
                    </UpdatedControls>
                </rad:AjaxSetting>
            </AjaxSettings>
        </rad:RadAjaxManagerProxy>
        <div>
            <rad:RadAjaxPanel ID="RadAjaxPanel1" runat="server" EnableAJAX="true" LoadingPanelID="LoadingPanel1">
                            <asp:LinkButton ID="btnToggleSearchMode" runat="server" OnClick="btnToggle_Click"
                                Text="toggle" />
                                <rad:RadDatePicker ID="picker" runat="server" Visible="false" />
            </rad:RadAjaxPanel>
            <rad:RadAjaxLoadingPanel ID="LoadingPanel1" runat="server" Skin="Office2007" MinDisplayTime="500" />
        </div>
    </div>
    </form>
</body>
</html>


Codebehind:
using System;
using System.Web.UI;

namespace CalendarTest
{
    public partial class _Default : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnToggle_Click(object sender, EventArgs e)
        {
            picker.Visible = !picker.Visible;
        }

    }
}


If the button is pressed while the datepicker is hidden, then the datepicker will not display correctly when the toggle is clicked.

Any help appreciated.

2 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 11 May 2009, 04:50 PM
Hi Olav,

I am sending you a simple runnable application with the desired functionality. Give it a try and see if it works for you or if I am leaving something important out.

Best,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Olav
Top achievements
Rank 1
answered on 12 May 2009, 07:07 AM
Using Style["display"] = "none" / "block" instead of Visible = false/true seems to work fine.

Thanks for the help :)

Tags
Calendar
Asked by
Olav
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Olav
Top achievements
Rank 1
Share this question
or