Kendo UI ASP.NET MVC Html.EditorFor() with styling problem

2 posts, 0 answers
  1. Demian
    Demian avatar
    4 posts
    Member since:
    Sep 2013

    Posted 19 Sep 2013 Link to this post

    Hi,

    I use Kendo UI ASP.NET MVC with VB.NET. My question is:
    How I can define the width for the @Html.EditorFor() width css?


    SampleView.vbhtml
            <td class="editor-field">
                @Html.EditorFor(Function(model) model.Tel1)        
                @Html.ValidationMessageFor(Function(model) model.Tel1)
            </td>

    I tried to define a css style like this:


    Site.css

    #small-editfor
    {
    width:30px;
    border-bottom-left-radius:0px;
    border-bottom-right-radius:0px;
    border-top-left-radius:0px;
    border-top-right-radius:0px;
    }

    SampleView.vbhtml
            <td class="editor-field">
                @Html.EditorFor(Function(model) model.Tel1,Nothing, "small-editfor",Nothing)
                @Html.ValidationMessageFor(Function(model) model.Tel1)
            </td>

    With this solution I see the width
    30px, but the value of the property Tel1 would’t be available on the server.

    I tried this also without success:

    SampleView.vbhtml
            <td class="editor-field">
                @Html.EditorFor(Function(model) model.Tel1 New With { .class=”small-editfor”})
                @Html.ValidationMessageFor(Function(model) model.Tel1)
            </td>

            <td class="editor-field">
                @Html.EditorFor(Function(model) model.Tel1 New With { .style=”width:30px”})  
                @Html.ValidationMessageFor(Function(model) model.Tel1)
            </td>

    Does anyone have an idea?
  2. Dimo
    Admin
    Dimo avatar
    8330 posts

    Posted 20 Sep 2013 Link to this post

    Hi Demian,

    I am not sure how is your scenario and question related to Kendo UI. Please clarify.

    In case you are trying to override or customize the default styling inside a Grid edit form, please make sure that you are using correct selectors with high-enough specificity. Using a web developer tool (e.g. Firebug) will help you greatly in this task.

    Regards,
    Dimo
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top