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

DatePicker vs. AjaxPanel

1 Answer 45 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Jerry
Top achievements
Rank 1
Jerry asked on 14 Oct 2010, 02:23 PM
Hi!

I get this error: 'Microsoft JScript runtime error: Invalid set operation on read-only property'.

When I have this code wrapped in an <telerik:RadAjaxPanel>:
-----------------------------------------------------------------------------
<asp:Button ID="TestButton" runat="server" Text="ShowCalendar" OnClick="TestButton_Click" />
<asp:Panel ID="DatePanel" runat="server" Visible="false">
    <telerik:RadDatePicker ID="DatePicker" runat="server" ShowPopupOnFocus="true" DateInput-ReadOnly="true" />
</asp:Panel>

Button Code:
----------------
protected void TestButton_Click(object sender, EventArgs e)
{
    DatePanel.Visible = true;
}

All I'm trying to do is set the panel to visible = true. Doesn't seem to work, I can reproduce this behaviour everytime.

EDIT:
If I set the Panels Visible="true" before the page starts I can show and hide the panel as much as I like without any problems. But I want it to be hidden initially.

EDIT [SOLVED]:
I solved it by settings the panel style to style="display: none;" And then in code remove the style using DatePanel.Style.Remove("display"); when I want to show the panel, this is only needed once after that I can use visible as I would normally. Strange problem.

Regards, Jerry

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 14 Oct 2010, 03:09 PM
Hi Jerry,

I can't seem to reproduce the described problem on the test page below, but I am glad that you have found a resolution.

<%@ Page Language="C#" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<script runat="server">
 
    protected void TestButton_Click(object sender, EventArgs e)
    {
        DatePanel.Visible = true;
    }
     
</script>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 
<head id="Head1" runat="server">
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<title>RadControls</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
 
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
 
<asp:Button ID="TestButton" runat="server" Text="ShowCalendar" OnClick="TestButton_Click" />
<asp:Panel ID="DatePanel" runat="server" Visible="false">
    <telerik:RadDatePicker ID="DatePicker" runat="server" ShowPopupOnFocus="true" DateInput-ReadOnly="true" />
</asp:Panel>
 
</telerik:RadAjaxPanel>
 
</form>
</body>
</html>


All the best,
Dimo
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Calendar
Asked by
Jerry
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or