Hi,
I have a problem with RadTextbox on ASP.NET,
when i change it's display/visibilty property lets say from "hidden" to "visible" it works, but when my moues hovers over it it disappears and changes back.
I tried the same thing on a normal asp:textbox and it worked just fine.
Can you help me?
Chrome +Javascript.
var txtbEmail = document.getElementById("txtbEmail");
txtbEmail.style.visibility = "visible";
I have a problem with RadTextbox on ASP.NET,
when i change it's display/visibilty property lets say from "hidden" to "visible" it works, but when my moues hovers over it it disappears and changes back.
I tried the same thing on a normal asp:textbox and it worked just fine.
Can you help me?
Chrome +Javascript.
var txtbEmail = document.getElementById("txtbEmail");
txtbEmail.style.visibility = "visible";
5 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 21 Sep 2013, 04:20 AM
Hi Zeev,
I couldn't replicate such an issue using the latest version of RadControls. You can also try the set_visible() method to achieve your requirement. Please have a look into the following code I tried which works fine at my end.
ASPX:
JavaScript:
Thanks,
Shinu.
I couldn't replicate such an issue using the latest version of RadControls. You can also try the set_visible() method to achieve your requirement. Please have a look into the following code I tried which works fine at my end.
ASPX:
<
telerik:RadTextBox
ID
=
"RadTextBox1"
runat
=
"server"
>
</
telerik:RadTextBox
>
<
br
/>
<
telerik:RadButton
ID
=
"RadButton1"
runat
=
"server"
AutoPostBack
=
"false"
Text
=
"Hide"
OnClientClicked
=
"hide"
>
</
telerik:RadButton
>
<
telerik:RadButton
ID
=
"RadButton2"
runat
=
"server"
AutoPostBack
=
"false"
Text
=
"Show"
OnClientClicked
=
"show"
>
</
telerik:RadButton
>
JavaScript:
<script type=
"text/javascript"
>
function
hide() {
$find(
'<%=RadTextBox1.ClientID %>'
).set_visible(
false
);
}
function
show() {
$find(
'<%=RadTextBox1.ClientID %>'
).set_visible(
true
);
}
</script>
Thanks,
Shinu.
0
Zeev
Top achievements
Rank 1
answered on 22 Sep 2013, 07:26 AM
Hi,
The "set_visible" method you provided doesn't do anything...
Also, i'm using the following JS to find the controller instead of your approach.
var txtbEmail = document.getElementById("RadTextBox1");
While your method does nothing,
Mine did work, but when my mouse still hovers over it, the controller disappear.
function chkEmailMe_CheckedChanged(sender, args) {
var txtbEmail = document.getElementById("RadTextBox1"); <<<finds it
var chkEmailMe = sender; <<<finds it
if (chkEmailMe.get_checked()) { <<<this method does work
txtbEmail.set_visible(true); <<<this method doesn't.
}
else
txtbEmail.style.visibility = "hidden";
}
The "set_visible" method you provided doesn't do anything...
Also, i'm using the following JS to find the controller instead of your approach.
var txtbEmail = document.getElementById("RadTextBox1");
While your method does nothing,
Mine did work, but when my mouse still hovers over it, the controller disappear.
function chkEmailMe_CheckedChanged(sender, args) {
var txtbEmail = document.getElementById("RadTextBox1"); <<<finds it
var chkEmailMe = sender; <<<finds it
if (chkEmailMe.get_checked()) { <<<this method does work
txtbEmail.set_visible(true); <<<this method doesn't.
}
else
txtbEmail.style.visibility = "hidden";
}
0
Shinu
Top achievements
Rank 2
answered on 23 Sep 2013, 04:17 AM
Hi Zeev,
The set_visible() is a Telerik RadInput property which will work with document.getElementById() if you use it as txtbEmail.control.set_visible(). Please have a look at the full code I have tried which works fine at my end.
ASPX:
JavaScript:
Thanks,
Shinu.
The set_visible() is a Telerik RadInput property which will work with document.getElementById() if you use it as txtbEmail.control.set_visible(). Please have a look at the full code I have tried which works fine at my end.
ASPX:
<
telerik:RadTextBox
ID
=
"RadTextBox1"
runat
=
"server"
ClientEvents-OnLoad
=
"OnLoad1"
>
</
telerik:RadTextBox
>
<
telerik:RadButton
ID
=
"RadButton1"
runat
=
"server"
Text
=
"Show/Hide TextBox"
ToggleType
=
"CheckBox"
ButtonType
=
"ToggleButton"
OnClientCheckedChanged
=
"OnClientCheckedChanged1"
AutoPostBack
=
"false"
>
</
telerik:RadButton
>
JavaScript:
<script type=
"text/javascript"
>
function
OnLoad1(sender, args) {
sender.set_visible(
false
);
}
function
OnClientCheckedChanged1(sender, args) {
var
textbox = document.getElementById(
"RadTextBox1"
);
if
(sender.get_checked()) {
textbox.control.set_visible(
true
);
}
else
textbox.control.set_visible(
false
);
}
</script>
Thanks,
Shinu.
0
Joseph
Top achievements
Rank 1
answered on 02 Sep 2014, 07:14 PM
I'm trying to do what you posted above, but i'm getting an error:
Script:
Error on page load
0x800a138f - JavaScript runtime error: Unable to get property 'set_visible' of undefined or null reference
<
telerik:RadTextBox
ID
=
"txtPassword"
runat
=
"server"
TextMode
=
"Password"
Width
=
"200px"
ClientEvents-OnLoad
=
"txtHide"
>
<
PasswordStrengthSettings
ShowIndicator
=
"true"
MinimumNumericCharacters
=
"1"
MinimumUpperCaseCharacters
=
"1"
OnClientPasswordStrengthCalculating
=
"CalculatingStrength"
CalculationWeightings
=
"50;20;20;10"
/>
</
telerik:RadTextBox
>
Script:
function txtHide(sender, args) {
sender.set_visible(false);
}
Error on page load
0x800a138f - JavaScript runtime error: Unable to get property 'set_visible' of undefined or null reference
0
Hi Joseph,
I just tried this markup on new page, and it works correct on my end. Could you tell us what is different in your scenario?
Regards,
Vasil
Telerik
I just tried this markup on new page, and it works correct on my end. Could you tell us what is different in your scenario?
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
>
</
telerik:RadScriptManager
>
<
script
type
=
"text/javascript"
>
function txtHide(sender, args) {
sender.set_visible(false);
}
function CalculatingStrength(sender, args) {
}
</
script
>
<
telerik:RadTextBox
ID
=
"txtPassword"
runat
=
"server"
TextMode
=
"Password"
Width
=
"200px"
ClientEvents-OnLoad
=
"txtHide"
>
<
PasswordStrengthSettings
ShowIndicator
=
"true"
MinimumNumericCharacters
=
"1"
MinimumUpperCaseCharacters
=
"1"
OnClientPasswordStrengthCalculating
=
"CalculatingStrength"
CalculationWeightings
=
"50;20;20;10"
/>
</
telerik:RadTextBox
>
Regards,
Vasil
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.