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

[Solved] Styles for EmptyMessage

6 Answers 28 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
David
Top achievements
Rank 1
David asked on 17 Aug 2011, 03:56 AM
Hi

With  controls that support the EmptyMessage  tag - what is the style that is used to format this

Many thanks
Dave

6 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 17 Aug 2011, 07:38 AM
Hello David,

The empty state look of the NumericTextBox is triggered by the t-state-empty CSS class, which applies an itallic font style to the <input> element. You can use this CSS class for any other element to apply the same font style.

Greetings,
Dimo
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

0
David
Top achievements
Rank 1
answered on 18 Aug 2011, 04:02 AM
Many thanks for that Dimo.

That worked.. almost. 

I set the following style

 

 

.t-state-empty

 

{

 

 

font-style:italic;

 

 

 

font-size:2;

 

 

 

background-color:#c0FFFF;

 

}

And I can confirm that the Empty Message has been set to this style.. However only the message part.. not the background of the textbox.  This means that there is a lot of white space left after the  message. This will be fine if all I display is  'Enter Input' but not for  text of varying length.

Many thanks for any help

Dave

0
Dimo
Telerik team
answered on 18 Aug 2011, 06:45 AM
Hi David,

I see that you are setting the empty-style CSS class to the DIV that holds the formatted value. You should set it to the INPUT element.

Here is some more information about the NumericTextBox HTML output:

http://www.telerik.com/help/aspnet-mvc/telerik-ui-components-numerictextbox-html-output-and-css-styles.html

Greetings,
Dimo
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

0
David
Top achievements
Rank 1
answered on 18 Aug 2011, 07:03 AM
Hi Dimo
Sorry - I am a little puzzled here trying to work out what to do.
The  .t-state-empty is for the  div that is over the textbox. I can understand that. So I either need to increase the length of the div to cover the textbox or.
Change the background of the textbox itself and toggle between  onblur and onfocus to change the background color

Or have I missed something completely/ I have read the link you sent before when I was searching for the EmptyMessage style.

Many thanks for any advice
Dave
0
Dimo
Telerik team
answered on 18 Aug 2011, 07:55 AM
Hello David,

Sorry about the misunderstanding - based on your first question I thought that you want to apply the t-state-empty CSS class manually.

In your case you can't use a background, because the <div> is not 100% wide by design. I tried to make it expand with custom CSS, but stumbled upon several cross-browser issues related to the element's alignment and positioning, so I suggest you to apply custom font styles only. If using a background color is a must, you should subscribe to the <input> element's focus and blur events and manage the empty-style CSS class manually.

Regards,
Dimo
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

0
David
Top achievements
Rank 1
answered on 18 Aug 2011, 08:11 AM
Hi Dimo

Unfortunately I have come to the same conclusions.  I took apart the Telerik.Textbox.Min.js to see how it handles the DIV aspects.

True - it is possible to find the size of the underlying textbox so to make the DIV the same width but likewise there are a LOT of cross browser issues (IE giving 'auto' and Firefox giving 'px')

That only leaves the OnBlur and  Focus events of the textbox.  So basically I would need to do the following

1. for both OnBlur and Focus get the  ID of the parent of the text box
2. If the  style of the parent is  t-empty-state then change the background of the textbox to  t-empty-state backgound
3. If the style of the parent is  t-formatted-value set the backgound to the default for the textbox

I would probally need to tweek the  DIV margings slightly so that the div is within the text-boxes borders.

Many thanks
Dave
Tags
General Discussions
Asked by
David
Top achievements
Rank 1
Answers by
Dimo
Telerik team
David
Top achievements
Rank 1
Share this question
or