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

[Solved] NumericTextBox - Setting Width

1 Answer 195 Views
NumericTextBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Rajesh
Top achievements
Rank 1
Rajesh asked on 12 Apr 2012, 10:01 AM
How do i set the width of a Numeric Text Box. I tried using HtmlAttributes, -style, width as below

<%=Html.Telerik().IntegerTextBox()
            .Name("itbUseAssumptionsIfDataOlderThan")
            .MinValue(0)
            .HtmlAttributes(new { style = "width: 20px" })
            .MaxValue(60)
%>

However, this only sets the width of the contained text box, and not the container with spinners. I have been able to set the width at runtime by using jquery, as below

           $("#itbUseAssumptionsIfDataOlderThan").width(20);

However, setting the width should hardly be the reason i should bind an event handler and use jquery. Is there an easier way?

1 Answer, 1 is accepted

Sort by
0
Enrico
Top achievements
Rank 1
answered on 26 Apr 2012, 10:07 AM
Hi Rajesh,

replacing .HtmlAttributes () with .InputHtmlAttributes() did the trick for me.

Hope it helps.

Enrico
Tags
NumericTextBox
Asked by
Rajesh
Top achievements
Rank 1
Answers by
Enrico
Top achievements
Rank 1
Share this question
or