Multiline style

6 posts, 0 answers
  1. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 02 Dec 2011 Link to this post

    Can you guys please give me a .riMulti on the root when the textbox is in multi-line mode please?  I need to style the multi differently than the normal textboxes

    (in the .skin file)

    So I know I can add a cssclass to the TBs in multline mode, but that means my developers will have to remember to do that, and they never will...but if I define it in the skin file, whenever they go into multiline mode it'll just be styled properly.

    So my problem is the style I need to change is on the wrapper span, I know the regular is an input while multi is a textarea...
  2. Galin
    Admin
    Galin avatar
    526 posts

    Posted 05 Dec 2011 Link to this post

    Hello Steve,

    The multiline textbox is a regular <textarea /> element. Therefore, you can set the following CSS rule:
    html body span.RadInput textarea.riTextBox {
        color: red;
    }

    I hope it helps.

    Kind regards,
    Galin
    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 05 Dec 2011 Link to this post

    Hi Galin,
      No again, that's not going to work...I need to know the control is a multiline on the root level to style it.  Like all the child elements are styled based on the parent right?

    For example:
     Can't style the "empty text" span since I don't know it's in mulitline mode, so styling it globally affects normal RadInputs...so even though I can set a border radius style on the textarea, the emptytext is hardcoded to the top-right awkwardly....if I change it, it changes for ALL radinputs
     
    It's horrible to try and work with when using .skin files to maintain consistency.  If they were different controls it wouldn't be an issue, but they aren't.

    Steve
  5. Galin
    Admin
    Galin avatar
    526 posts

    Posted 06 Dec 2011 Link to this post

    Hello Steve,

    I can suggest you the following ways to achieve this:
    The first one is to make it client-side, with Javascript (jQuery):

    function pageLoad()
    {
        $telerik.$('.RadInput textarea.riTextBox').parent().addClass('riMulti');
    }

    It is also possible to add this CssClass server-side by using the property WrapperCssClass, e.g.

    C#:
    protected void SetStyleIfNeeded(Control o)
    {
        RadTextBox tb = o as RadTextBox;
        if (tb != null && tb.TextMode == InputMode.MultiLine)
        {
       tb.EnableSingleInputRendering = true; //Enable Single Input Rendering
            tb.WrapperCssClass = "riMulti";
        }
     
        foreach (Control c in o.Controls)
        {
            SetStyleIfNeeded(c);
        }
    }
     
    protected void Page_PreRender(object sender, EventArgs e)
    {
        SetStyleIfNeeded(Page.Form);
    }

    Additionally, please note that in the official release the property WrapperCssClass works only in SingleInputRendering Mode, but this issue is already fixed in the latest internal build.

    I hope this helps.

    All the best,
    Galin
    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
  6. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 06 Dec 2011 Link to this post

    Yeah, I know I can style it with jQuery :)  But I can't style it with jQuery is my problem\request...

    I only have access to a .skin file to dictate how these controls display for my developers, and I can't tell the skin file to load a script
  7. Galin
    Admin
    Galin avatar
    526 posts

    Posted 08 Dec 2011 Link to this post

    Hello Steve,

    I am afraid this cannot be achieve only with CSS. You can style the textarea in MultilineMode as I showed you in the first post, but for other elements inside the RadControl you need to add new CSS class(es).


    Greetings,
    Galin
    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017