problems with .visible

2 posts, 0 answers
  1. Paul
    Paul avatar
    56 posts
    Member since:
    Nov 2010

    Posted 15 Jun 2012 Link to this post

    Hi. I'm using the XmtHttpPanel for the first time. At the moment I have the XmlHttpPanel within a <div id="panelDiv" runat="server">

    At the moment I am using callback similar to the first look demo on the Telerik website (ie javascript to set the XmlHttpPanel.value and that then calling code behind).

    If I set the panelDiv.visible = false; nothing seems to happen. If I set panel.visible = false; the panel disappears. However, if I then make another click that results in panel.visible=true; I get an error:

        Server Error in '/prototype' Application. 
         Script control 'Async_highlights' is not a registered script control. Script controls must be registered using RegisterScriptControl()
         before calling RegisterScriptDescriptors(). 
        Parameter name: scriptControl

    I also have a button separate to the XmlHttlpPanel that I want to also use to switch the panel's visibility. I found problem using .visible but it seems to work using the display attribute.

    Can you give any advice about the best way to hide/show an XmlHttpPanel dynamically (I don't care about the content because if the panel is subsequently revealed again the content will be updated).

  2. Slav
    Slav avatar
    1359 posts

    Posted 19 Jun 2012 Link to this post

    Hello Paul,

    You can use JavaScript to switch the CSS display property of the div element in order to toggle its visibility. The following code sample shows a possible approach to do this (SetVisibility is a handler of an input's onclick event):
    function SetVisibility() {
        var panelDiv = $get("panelDiv");
        if ( == "none") {
   = "block";
        } else {
   = "none";

    As for the error that you encountered, the RadXmlHttpPanel loads it data by using ASP.NET's Callback mechanisms and Web Services. These methods do not offer Viewstate and there is no page lifecycle. This prevents the server-side event handlers from execution and therefore the server-side interaction among the controls inside the panel is limited. In your case most probably there is a ASP control in the RadXmlHttpPanel that strongly relies on ViewState, which results in the encountered problem. You should consider using the RadXmlHttpPanel for loading presentation data, which is its primary purpose.

    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top