Hi,
I'm having some challenges hiding/showing a RadTextBox.
The set_visible client side method does not seem to work, so I'm using the following:
document.getElementById('<%= txtURL.ClientID %>').style.display = 'block';
This makes the box visible, but as soon as I move the mouse over the field, it disappears!
Also, once the box is visible if I check another radio button like File, and then come back and check Link, the box does not reappear.
It seems that it only shows the first time I check the Link button.
Happening in IE, FF and Chrome.
Here's my complete scenario (see attached screenshot).
I have 3 radio buttons all of which have an OnClientCheckedChanged event defined.
These event handlers hide/show relevant controls.
I check the None radio button and hide all of the related labels/controls in the Page_Load event (code behind).
Here's the relevant code snippets.
Code Behind:
RadTextBox declaration:
Radio Buttons:
OnClientCheckedChanged Handlers:
Any thoughts?
My thanks in advance.
Jim
I'm having some challenges hiding/showing a RadTextBox.
The set_visible client side method does not seem to work, so I'm using the following:
document.getElementById('<%= txtURL.ClientID %>').style.display = 'block';
This makes the box visible, but as soon as I move the mouse over the field, it disappears!
Also, once the box is visible if I check another radio button like File, and then come back and check Link, the box does not reappear.
It seems that it only shows the first time I check the Link button.
Happening in IE, FF and Chrome.
Here's my complete scenario (see attached screenshot).
I have 3 radio buttons all of which have an OnClientCheckedChanged event defined.
These event handlers hide/show relevant controls.
I check the None radio button and hide all of the related labels/controls in the Page_Load event (code behind).
Here's the relevant code snippets.
Code Behind:
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(!IsPostBack)
{
lblURL.Style.Add(
"display"
,
"none"
);
txtURL.Style.Add(
"display"
,
"none"
);
lblUpload.Style.Add(
"display"
,
"none"
);
uplAttachment.Style.Add(
"display"
,
"none"
);
lblFileName.Style.Add(
"display"
,
"none"
);
lblFileNameValue.Style.Add(
"display"
,
"none"
);
optAttachment.Checked =
false
;
optURL.Checked =
false
;
optNone.Checked =
true
;
taskID = Request.QueryString[
"taskID"
].ToString();
txtTaskID.Text = taskID;
}
}
RadTextBox declaration:
<
tr
>
<
td
class
=
"templateLabel"
>
runat
=
"server"
Text
=
"Link:"
></
asp:Label
>
<
asp:Label
ID
=
"lblFileName"
ToolTip
=
"File Name of last upload"
runat
=
"server"
Text
=
"File Name:"
></
asp:Label
>
</
td
>
<
td
class
=
"templateValue"
>
<
telerik:RadTextBox
ID
=
"txtURL"
MaxLength
=
"300"
runat
=
"server"
EmptyMessage
=
"Specify a link (must start with http:// or https://)"
Width
=
"450px"
Enabled='<%# (Boolean)Session["EditProcess"] %>'>
</
telerik:RadTextBox
>
<
asp:Label
ID
=
"lblFileNameValue"
Text
=
"File Name goes here"
ToolTip
=
"File Name of last upload"
runat
=
"server"
></
asp:Label
>
</
td
>
</
tr
>
Radio Buttons:
<
tr
>
<
td
class
=
"templateLabel"
>
<
asp:Label
ID
=
"lblAttachmentType"
runat
=
"server"
Text
=
"Reference:"
></
asp:Label
>
</
td
>
<
td
class
=
"templateValue"
>
<
telerik:RadButton
runat
=
"server"
AutoPostBack
=
"False"
Enabled='<%# (Boolean)Session["EditProcess"] %>' ID="optAttachment" ButtonType="ToggleButton" ToggleType="Radio" GroupName="urlOrAtt" Text="File" Value="attachment" OnClientCheckedChanged="optAttachment_CheckedChanged"></
telerik:RadButton
>
<
telerik:RadButton
runat
=
"server"
AutoPostBack
=
"False"
Enabled='<%# (Boolean)Session["EditProcess"] %>' ID="optURL" ButtonType="ToggleButton" ToggleType="Radio" GroupName="urlOrAtt" Text="Link" Value="url" OnClientCheckedChanged="optUrL_CheckedChanged"></
telerik:RadButton
>
<
telerik:RadButton
runat
=
"server"
AutoPostBack
=
"False"
Enabled='<%# (Boolean)Session["EditProcess"] %>' ID="optNone" ButtonType="ToggleButton" ToggleType="Radio" GroupName="urlOrAtt" Text="None" Value="none" OnClientCheckedChanged="optNone_CheckedChanged"></
telerik:RadButton
>
</
td
>
</
tr
>
OnClientCheckedChanged Handlers:
function
optUrL_CheckedChanged(sender, eventArgs) {
if
(!g_rowSelected) {
if
(sender.get_checked()) {
alert(
'Link selected'
);
//var txtURL = $find("<%=txtURL.ClientID%>");
//txtURL.clear();
//txtURL.set_visible(true);
document.getElementById(
'<%= txtURL.ClientID %>'
).style.display =
'block'
;
document.getElementById(
'<%= lblURL.ClientID %>'
).style.display =
'block'
;
$find(
"<%=uplAttachment.ClientID%>"
).set_visible(
false
);
document.getElementById(
'<%= lblUpload.ClientID %>'
).style.display =
'none'
;
document.getElementById(
'<%= lblFileName.ClientID %>'
).style.display =
'none'
;
document.getElementById(
'<%= lblFileNameValue.ClientID %>'
).style.display =
'none'
;
}
EnableSave();
}
}
function
optAttachment_CheckedChanged(sender, eventArgs) {
if
(!g_rowSelected) {
if
(sender.get_checked()) {
alert(
'File selected'
);
var
txtURL = $find(
"<%=txtURL.ClientID%>"
);
txtURL.clear();
txtURL.set_visible(
false
);
document.getElementById(
'<%= lblURL.ClientID %>'
).style.display =
'none'
;
$find(
"<%=uplAttachment.ClientID%>"
).set_visible(
true
);
document.getElementById(
'<%= lblUpload.ClientID %>'
).style.display =
'block'
;
document.getElementById(
'<%= lblFileName.ClientID %>'
).style.display =
'block'
;
document.getElementById(
'<%= lblFileNameValue.ClientID %>'
).style.display =
'block'
;
}
EnableSave();
}
}
function
optNone_CheckedChanged(sender, eventArgs) {
if
(!g_rowSelected) {
if
(sender.get_checked()) {
alert(
'None selected'
);
var
txtURL = $find(
"<%=txtURL.ClientID%>"
);
txtURL.clear();
txtURL.set_visible(
false
);
document.getElementById(
'<%= lblURL.ClientID %>'
).style.display =
'none'
;
$find(
"<%=uplAttachment.ClientID%>"
).set_visible(
false
);
document.getElementById(
'<%= lblUpload.ClientID %>'
).style.display =
'none'
;
document.getElementById(
'<%= lblFileName.ClientID %>'
).style.display =
'none'
;
document.getElementById(
'<%= lblFileNameValue.ClientID %>'
).style.display =
'none'
;
}
EnableSave();
}
}
Any thoughts?
My thanks in advance.
Jim