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

RadTextBox Setting width programmatically

2 Answers 237 Views
Input
This is a migrated thread and some comments may be shown as answers.
Jonathan Zee
Top achievements
Rank 1
Jonathan Zee asked on 07 Jun 2013, 04:52 AM
Hi guys,

I have just upgraded my telerik controls and discovered that all radinputs ( radtextbox, datepicker etc..) width have gone awry. Everything is now set to 100% width even though it was specified in the inline code to be of a certain pixel.


e.g.
<telerik:RadTextBox ID="tbxSomething" runat="server" Skin="Default" width="250px"></telerik:RadTextBox>

When i go thru my firebug, it shows the default style as:

html body .riSingle .riTextBox[type="text"] {
    margin0;
    padding-left5px;
    padding-right5px;
    width100%;
}

even though the parent span is taking the specifed width into consideration but it's still rendering the control as 100% width due to the above css style.

<span id="tbxSomething_wrapper" class="riSingle RadInput RadInput_Default" style="width: 250px;">
  /*input control here*/
</span>

I can't actually override html body .riSingle .riTextBox[type="text"] style as it seems that every other "textbox like" input is using that same style..including datepickers.

Is there way where I can be able to set the width of specific textboxes without the use of CSS as these controls are generated dynamically from xml --> xslt --> aspx and I would like the users to be able to define the width of textboxes based on the type of input.

Please advise?

Regards

Jonathan

2 Answers, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 11 Jun 2013, 07:43 AM
Hello,

When set Width to the RadTextBox, this width to the whole control, not only the Input element. The Control can have several parts, Label, Input and Button (+ spinButtons)
So when you set 250px, it applies to the wrapper. The Input element inside has width 100%, but this width will not go pass the width of its parent.
In case when you don't have label or button, the 100% of 250px, will be 250px. So the input will be exact as its parent.

If the Input is bigger than it's parent, then most probably you have set some additional styles, that should not be applied, like Relative or Absolute Position. Check for such CSS and remove it to avoid any problems.

Regards,
Vasil
Telerik
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 the blog feed now.
0
Jonathan Zee
Top achievements
Rank 1
answered on 11 Jun 2013, 08:20 AM
Hi Vasil,

Thanks for that.
Tags
Input
Asked by
Jonathan Zee
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Jonathan Zee
Top achievements
Rank 1
Share this question
or