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

set_visible(true)

1 Answer 214 Views
Input
This is a migrated thread and some comments may be shown as answers.
Paolo
Top achievements
Rank 1
Paolo asked on 20 Oct 2009, 10:46 PM
I doesn't look like set_visible(true) works.  I tried the latest release as well as the current beta.

set_visible(false) seems to work fine.

I have the following code:

var txt = $find('<%= pnl.Items[0].FindControl( "txt" ).ClientID %>'); 
 
if(cb.checked) { 
   txt.set_visible(true); 
} else { 
   txt.set_visible(false); 

pnl is a radpanelbar.  txt is a radtextbox.

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 21 Oct 2009, 07:11 AM
Hi Paolo,

The problem has been fixed after the beta and changes will take effect in the official release. Sorry for the temporary inconvenience. In the meantime, you can use the following workaround:

<%@ Page Language="C#" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 
<head runat="server">
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<title>RadControls for ASP.NET AJAX</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
 
<asp:CheckBox ID="CheckBox1" runat="server" Checked="true" />
 
<asp:Button ID="Button1" runat="server" Text="Toggle Visibility" OnClientClick="return toggle();" />
 
<br /><br />
 
<telerik:RadTextBox ID="RadTextBox1" runat="server" />
 
<script type="text/javascript">
 
function toggle()
{
    if ($get("<%= CheckBox1.ClientID %>").checked)
        $find("<%= RadTextBox1.ClientID %>").set_visible(true);
    else
        $find("<%= RadTextBox1.ClientID %>").set_visible(false);
     
    return false;
}
 
if (typeof(Telerik) != "undefined" && typeof(Telerik.Web.UI.RadInputControl) != "undefined")
{
    Telerik.Web.UI.RadInputControl.prototype.set_visible = function(value)
    {
        if (value == true && this._originalDisplay != null)
        {
            this.get_wrapperElement().style.display = this._originalDisplay;
            this.repaint();
        }
        else if (value == false && this.get_visible())
        {
            this._originalDisplay = this.get_wrapperElement().style.display;
            this.get_wrapperElement().style.display = "none";
        }
    }
}
 
</script>
 
</form>
</body>
</html>


Kind regards,
Dimo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Input
Asked by
Paolo
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or