Hello everyone,
I'm trying to use Server snippets incrusted in HTML with no luck. The code is as follows:
The server throws me the following exception:
The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
I know I have to use RadScriptBlock if I want to use it in javascript, but how can I achieve this behavior with Telerik?
I also know that Telerik:RadTextBox contains a label option, but I need it this way because I'm using a CSS template.
in advance, thanks
I'm trying to use Server snippets incrusted in HTML with no luck. The code is as follows:
<
label
for="<%= myTextBox.ClientID %>" >Text</
label
>
<
asp:TextBox
id
=
"myTextBox"
runat="server />
The server throws me the following exception:
The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
I know I have to use RadScriptBlock if I want to use it in javascript, but how can I achieve this behavior with Telerik?
I also know that Telerik:RadTextBox contains a label option, but I need it this way because I'm using a CSS template.
in advance, thanks
6 Answers, 1 is accepted
0

Princy
Top achievements
Rank 2
answered on 17 Oct 2012, 05:15 AM
Hi Gabriel,
I suppose you want to set CSS for label in the RadTextBox. You can override the default Css as shown below.
ASPX:
CSS:
Please elaborate your scenario if it doesn't helps.
Regards,
Princy.
I suppose you want to set CSS for label in the RadTextBox. You can override the default Css as shown below.
ASPX:
<
telerik:RadTextBox
ID
=
"myTextBox"
runat
=
"server"
Label
=
"Your Label"
>
</
telerik:RadTextBox
>
CSS:
<style type=
"text/css"
>
.RadInput_Default .riLabel
{
color
:Red
!important
; //Your style
}
</style>
Please elaborate your scenario if it doesn't helps.
Regards,
Princy.
0

Gabriel
Top achievements
Rank 2
answered on 17 Oct 2012, 01:18 PM
Hello Princy, thank you for the reply.
I don't want to override the CSS.
Look, the problem is I have to create the following structure for my form elements:
I can't create this structure with Telerik:RadTextBox, can I?
I think one solution might be to create an user-control, but I don't really understand why Telerik limits so much this incredible feature of asp.
I don't want to override the CSS.
Look, the problem is I have to create the following structure for my form elements:
<
div
class
=
"control-group"
>
<
label
for="<%= myTextBox.ClientID %>" class="control-label">LabelText</
label
>
<
div
class
=
"controls"
>
<
asp:TextBox
ID
=
"myTextBox"
runat
=
"server"
CssClass
=
"input-square"
>
</
div
>
</
div
>
I can't create this structure with Telerik:RadTextBox, can I?
I think one solution might be to create an user-control, but I don't really understand why Telerik limits so much this incredible feature of asp.
0

Princy
Top achievements
Rank 2
answered on 18 Oct 2012, 04:35 AM
Hi,
Unfortunately I cannot replicate the issue at my end. I was able to show a label with RadTextBox. Attached is the screenshot.
aspx:
Regards,
Princy.
Unfortunately I cannot replicate the issue at my end. I was able to show a label with RadTextBox. Attached is the screenshot.
aspx:
<
div
class
=
"control-group"
>
<
label
for="<%= myTextBox.ClientID %>" class="control-label">LabelText</
label
>
<
div
class
=
"controls"
>
<
telerik:RadTextBox
ID
=
"myTextBox"
runat
=
"server"
CssClass
=
"input-square"
></
telerik:RadTextBox
>
</
div
>
</
div
>
Regards,
Princy.
0

Gabriel
Top achievements
Rank 2
answered on 18 Oct 2012, 06:00 PM
Nice, now add a RadScriptManager and a RadAjaxManager to the page and see how it behaves.
Thanks.
Thanks.
0
Accepted
Hello Gabriel,
I would like to refer back to your original post. You could use
This will work even if the myTextBox is RadTextBox, if you are using versions after Q1 2012
Kind regards,
Vasil
the Telerik team
I would like to refer back to your original post. You could use
<
asp:Label
runat
=
"server"
AssociatedControlID
=
"myTextBox"
/>
This will work even if the myTextBox is RadTextBox, if you are using versions after Q1 2012
Kind regards,
Vasil
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.
0

Gabriel
Top achievements
Rank 2
answered on 19 Oct 2012, 02:18 PM
OMG!!
This is the first time I see AssociatedControlID property!!!! I didn't know it existed!!!
thank you Vasil.
PS: That sound really noob, I know xD
This is the first time I see AssociatedControlID property!!!! I didn't know it existed!!!
thank you Vasil.
PS: That sound really noob, I know xD