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

[Solved] Width of textbox in edit form

3 Answers 86 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Mattias
Top achievements
Rank 1
Mattias asked on 16 Nov 2010, 04:22 PM
Hi,
I'm using data annotations to display a form in the grid.
How can I set different styles to text boxes?
I want to set different widths for different text boxes.
Now when the form is generated all text boxes has the same css classes.
<div class="editor-label"><label for="FirstName">Förnamn</label></div>
<div class="editor-field"><input class="text-box single-line" id="FirstName" name="FirstName" type="text" /> <span class="field-validation-valid" id="FirstName_validationMessage"></span></div>
<div class="editor-label"><label for="LastName">Efternamn</label></div>
<div class="editor-field"><input class="text-box single-line" id="LastName" name="LastName" type="text" /> <span class="field-validation-valid" id="LastName_validationMessage"></span></div>

Is there a way to set it directly on the model class like the other attributes?

3 Answers, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 17 Nov 2010, 07:59 AM
Hello Mattias,

 The only way to achieve this is by defining a custom editor template for that particular properties. You can check Brad Wilson's blog post for additional info.

Regards,
Atanas Korchev
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
jfkrueger
Top achievements
Rank 1
answered on 12 Jun 2012, 02:27 PM
I don't see how to apply what is said in that post to a grid, and I don't see how it allows you to set different lengths on different textboxes in edit mode. Am I missing something??

Thanks!
0
Atanas Korchev
Telerik team
answered on 12 Jun 2012, 03:18 PM
Hi Joe,

 This blog post shows how to use editor templates to customize the editors for various properties. You need to create custom editor templates when you need to customize the default editor generated by ASP.NET MVC.

Regards,
Atanas Korchev
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 Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
Tags
Grid
Asked by
Mattias
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
jfkrueger
Top achievements
Rank 1
Share this question
or