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

RadNumericTextBox Width

5 Answers 562 Views
Input
This is a migrated thread and some comments may be shown as answers.
Mac
Top achievements
Rank 2
Mac asked on 16 Oct 2007, 09:56 PM

Just an observation but it seems slightly unusual that the width property of the RadNumericTextBox control includes the Label. I might be slow but it took me a while to realise why all my inputs were so teeny.

Including a labelwidth property or just leaving it to the LabelCssClass to set in my head makes more sense.

Just my 2 cents!

5 Answers, 1 is accepted

Sort by
0
Petja
Telerik team
answered on 18 Oct 2007, 04:23 PM
Hello Mac,

Thank you for contacting us and for your feedback.
The RadInput controls have a css class (radLabelCss_[SkinName]) which is rendered to its label component but if you set width as its setting it will not be respected due to the specific rendering and always will be as wide as the text  value of the Label is. We consider that this is a better approach because if there is a property LabelWidth it should be always set with the exact label text width (in order to achieve the label text to be prior to the input component and not to be cut by it) but precise text width can not be counted so easily. As the label is a part of control, its width should be also a part of the control width with the current version of the control. We will investigate the problem further and if there is a solution to preserve the input width not to be related to the label one. Your Telerik points are updated.

Kind regards,
Petja
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Shaun Peet
Top achievements
Rank 2
answered on 22 Oct 2007, 01:45 PM
IMHO since the RadTextBox is a replacement for the standard TextBox, the Width property should affect the same changes and therefore the Width ought to specify the width of the box itself - not the the label, spinbuttons, or buttons.
0
Petja
Telerik team
answered on 23 Oct 2007, 12:23 PM
Hello Shaun Peet,

As the buttons and the label are parts of the control and someone sets Width="100%" he/she expects this width to affect the entire control including the buttons and the label, which is why the Width of the RadInput control affects all control's components (if they are set). Concerning the Label width, you could control it by its css class: radLabelCss_[SkinName]. Note that it should have set display mode (which is a browser specific setting) in order to apply the defined width, i.e.:
<head runat="server"
    <style type="text/css"
    .radLabelCss_Default 
    { 
        display: inline-block; 
        width: 50px;        
    } 
</style> 
</head> 
<body class="body"
    <form runat="server" id="mainForm" method="post">         
        <radI:radtextbox id="RTB1" runat="server" label="label"
        </radI:radtextbox>                 
    </form> 
</body> 
 
When the Label property is set, an accessibility label with for tag for the textbox component of the input is rendered. You can see from the following code that even if you use label outside of the RadInput control for it (not using the Label property) and set its width it will not be affected until you set display mode too:
<i>Label width not respected set width of 200px: </i><br /> 
<label id="Label1" for="RTB2_text" style="width: 200px;">Label</label> 
<radI:RadTextBox ID="RTB2" runat="server"
</radI:RadTextBox> 
<br /> 
<i>Label with width of 200px: </i><br /> 
<label id="Label2" for="RTB2_text" style="width: 200px; display:inline-block;">Label</label> 
<radI:RadTextBox ID="RadTextBox1" runat="server"
</radI:RadTextBox> 

Let us know if you have further questions.

Sincerely yours,
Petja
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
George
Top achievements
Rank 1
answered on 19 Jun 2009, 01:21 AM
OK -- Two problems -- First -- your design time veiw is VS 2008 does not show the label correct;y of it has spaces in it.  Second, you control does not appear follow normal style convention regarding centering.  In the following example - the Div, table and text all correctly allgin to the center.  You control however does not.

 

<%

@ Page Language="VB" AutoEventWireup="false" CodeFile="TextCenter.aspx.vb" Inherits="TextCenter" %>

 

<%

@ Register Assembly="RadInput.Net2" Namespace="Telerik.WebControls" TagPrefix="radI" %>

 

 

 

<!

 

DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 

<

 

html xmlns="http://www.w3.org/1999/xhtml">

 

<

 

head runat="server">

 

 

 

 

 

<title>Untitled Page</title>

 

</

 

head>

 

<

 

body>

 

 

 

 

 

<form id="form1" runat="server">

 

 

 

 

 

<div style="margin-left: 5px ; margin-right: 5px ;">

 

 

 

 

 

<div style="width: auto; text-align:center;">

 

 

 

 

 

<radI:RadNumericTextBox Label="My Label 1: "

 

 

 

 

 

ID="RadNumericTextBox1" runat="server" >

 

 

 

 

 

</radI:RadNumericTextBox>

 

 

 

 

 

</div>

 

 

 

 

This is a test

 

<table border="1px" style="margin-left:auto; margin-right:auto;text-align:center;">

 

 

 

 

 

<tr>

 

 

 

 

 

<td> test </td>

 

 

 

 

 

<td> test </td>

 

 

 

 

 

</tr>

 

 

 

 

 

</table>

 

 

 

 

 

</div>

 

 

</div>

 

 

 

 

 

</form>

 

</

 

body>

 

</

 

html>

 

0
Dimo
Telerik team
answered on 19 Jun 2009, 07:52 AM
Hello George,

Thanks for the code snippet.

The ongoing development of the old ("classic") RadControls for ASP.NET has been discontinued for almost 2 years. As a result, you may experience problems in VS 2008 design time or IE8, as these have been released afterwards. Currently we fix only critical issues related to functionality. Upgrading to the new RadControls for ASP.NET AJAX, especially for new web applications is highly recommended for a number of reasons - features, performance, etc.

Regarding the browser centering, I suppose you see the problem in IE8 (at least I don't see a problem in other browsers, see attachment). Please use the classic RadControls with a IE8 compatibility meta tag, so that the browser behaves like IE7.

Greetings,
Dimo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Input
Asked by
Mac
Top achievements
Rank 2
Answers by
Petja
Telerik team
Shaun Peet
Top achievements
Rank 2
George
Top achievements
Rank 1
Dimo
Telerik team
Share this question
or