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

Multiline style

5 Answers 113 Views
Input
This is a migrated thread and some comments may be shown as answers.
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
sitefinitysteve asked on 02 Dec 2011, 03:55 PM
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...

5 Answers, 1 is accepted

Sort by
0
Galin
Telerik team
answered on 05 Dec 2011, 07:37 PM
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
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 05 Dec 2011, 07:49 PM
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
0
Galin
Telerik team
answered on 06 Dec 2011, 02:25 PM
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
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 06 Dec 2011, 02:42 PM
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
0
Galin
Telerik team
answered on 08 Dec 2011, 05:49 PM
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
Tags
Input
Asked by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Answers by
Galin
Telerik team
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Share this question
or