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

Dropdownlist Validation showing up as alert box versus other fields

3 Answers 185 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Sean Bornstein
Top achievements
Rank 1
Sean Bornstein asked on 26 Mar 2013, 05:25 PM
Hello all,

I have an editor template popup and on it I have two dropdownlist controls on it.   On another popup I have the validations show up as yellow messages on the popup form.   On this one these show a "Message from web page" alert box and "Errors:" showing the error messages.  How do I make this show similar to the other textboxes for example where it shows it hovering over the control the yellow validation messages?

<div class="editor-label">
@Html.LabelFor(model => model.UserName)
</div>
<div class="editor-field">
@(Html.Kendo().DropDownList()
.Name("UserName")
.DataValueField("UserName")
.DataTextField("UserName")
.OptionLabel("--Select Value--")
.BindTo((System.Collections.IEnumerable)ViewData["ADUserList"])
)

@Html.ValidationMessageFor(model => model.UserName)
</div>

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 28 Mar 2013, 04:54 PM
Hi,

I am not sure what could be causing this behavior. The Kendo Validator always shows the messages using a tooltip. Could you provide a runnable sample so I can investigate what is causing the problem?

Regards,
Daniel
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Sean Bornstein
Top achievements
Rank 1
answered on 29 Mar 2013, 04:54 PM
Yes Daniel I will put that together.
0
Daniel
Telerik team
answered on 01 Apr 2013, 10:53 AM
Hi again,

A possible reason for the message to be displayed with alert is if the client validation is not triggered and you are using the DataSource error event to alert the server errors. If that is the case then the problem could be caused by the Name being prefixed with the current HtmlFieldPrefix. Please try using the DropDownListFor helper instead:

@(Html.Kendo().DropDownListFor(m => m.UserName)
    .DataValueField("UserName")
    .DataTextField("UserName")
    .OptionLabel("--Select Value--")
    .BindTo((System.Collections.IEnumerable)ViewData["ADUserList"])
)
If you are adding custom validation errors on the server then you could use the approach demonstrated in this code-library to show the messages as tooltips. Regards,
Daniel
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
DropDownList
Asked by
Sean Bornstein
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Sean Bornstein
Top achievements
Rank 1
Share this question
or