Apply class client-side to RadNumericTextBox

4 posts, 1 answers
  1. Sean
    Sean avatar
    200 posts
    Member since:
    Nov 2010

    Posted 17 Mar 2011 Link to this post

    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
  2. Mira
    Admin
    Mira avatar
    1124 posts

    Posted 21 Mar 2011 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Sean
    Sean avatar
    200 posts
    Member since:
    Nov 2010

    Posted 21 Mar 2011 Link to this post

    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
  5. Answer
    Mira
    Admin
    Mira avatar
    1124 posts

    Posted 22 Mar 2011 Link to this post

    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
Back to Top