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

Apply class client-side to RadNumericTextBox

3 Answers 193 Views
Input
This is a migrated thread and some comments may be shown as answers.
Sean
Top achievements
Rank 2
Sean asked on 17 Mar 2011, 10:43 PM
Hi All,

I glanced through the search for a little bit, but couldn't find an example that worked for me.

I have a RadNumericTextBox in a RadWindow. I am passing arguments to the RadWindow and I need to be able to enable/disable the text box before it is shown to the user. I do this, but the label next to the text box remains gray. I have remedied this in other scenarios, but I am struggling here.

            function pageLoad() {
                var oWindow = GetRadWindow();
                properties = oWindow.argument;
 
                if (properties) {
                    if (properties["AutoRefreshEnabled"] == "True") {
                        CheckBox1.checked = true;
                        $find("<%= RadNumericTextBox1.ClientID %>").set_value(properties["AutoRefreshInterval"]);
                        $find("<%= RadNumericTextBox1.ClientID %>").enable();
//Apply CSS Class here
                    }
                 }

I tried a few examples, but basically all I'd like to do is the equivalent of "RadNumericTextBox1.LabelCssClass = "LabelEnabled"" where LabelEnabled is the CssClass that applies the appropriate coloring scheme to the label. How can I achieve this client-side?

Thanks

Sean

3 Answers, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 21 Mar 2011, 01:22 PM
Hello Sean,

Please use the following code to set the desired class:
var textBoxElement = $find("<%= RadNumericTextBox1.ClientID %>")._textBoxElement;
textBoxElement.className = textBoxElement.className + " className";

I hope this helps.

All the best,
Mira
the Telerik team
0
Sean
Top achievements
Rank 2
answered on 21 Mar 2011, 06:24 PM
Hi Mira,

I used the follow code, but saw no change.

if (properties["AutoRefreshEnabled"] == "True") {
    CheckBox1.checked = true;
    $find("<%= RadNumericTextBox1.ClientID %>").set_value(properties["AutoRefreshInterval"]);
    $find("<%= RadNumericTextBox1.ClientID %>").enable();
    var textBoxElement = $find("<%= RadNumericTextBox1.ClientID %>")._textBoxElement;
    textBoxElement.className = textBoxElement.className + " LabelEnabled";
   //textBoxElement.className = "LabelEnabled";
}

.LabelEnabled
{
color: Black !important;
}
CheckBox1 is checked, RadNumericTextBox1 is enabled and has the value of AutoRefreshInterval. RadNumericTextBox1's label remains gray instead of turning to black, however.

I attempted the commented out version of code, as well. Any advice?

Thanks,

Sean
0
Accepted
Mira
Telerik team
answered on 22 Mar 2011, 05:03 PM
Hello Sean,

Thank you for the additional information.

In order to implement the desired functionality, I recommend that you add the desired rule to the .riTextBox class.

Please examine the following help topics for additional information:
CSS Skin File Selectors
Understanding the HTML Output and CSS Styling

I hope this helps.

Regards,
Mira
the Telerik team
Tags
Input
Asked by
Sean
Top achievements
Rank 2
Answers by
Mira
Telerik team
Sean
Top achievements
Rank 2
Share this question
or