asp.net-mvckendo-uiunobtrusive-validationkendo-ui-mvckendo-validator

Kendo UI Validation for Razor instead of Html


I use Kendo validator in my MVC application and want to change the position of validation message from below to right of the input. Although the html code of Kendo UI validation appears right of the input, the same code shows validation message below the input instead of right of it. Is there any mistake or how to convert it to razor? Please note that there is no space between "required" and "validationmessage" in razor code, but when using it as html code an error encountered. Any idea?

You might have a look at: http://jsbin.com/kubohuniki/1/edit?html,output

This line shows validation message on "right" of the input:

<label>Label RIGHT</label>
<input id="Name" class="k-textbox" required validationmessage="required field" />  

This line shows validation message on "below" of the input:

 <label>Label BELOW</label>
 @Html.Kendo().TextBoxFor(m => m.Name, new { @class="k-textbox", requiredvalidationmessage="required field"  })

Solution

  • try this (updated)

      @Html.TextBoxFor(m => m.Question, new { @class = "k-textbox",
    
    
    required = "true", validationmessage = "required field" }) 
    
    @Html.ValidationMessageFor(model => model.Question)