简体   繁体   English

如何在MessageBox中显示验证摘要?

[英]How to show Validation Summary in MessageBox?

I try to do dynamic validation summary. 我尝试做动态验证摘要。 As you see this picture , I want to show validation summary as in bubble next to button. 正如你看到这张照片 ,我想说明验证摘要在旁边的按钮泡沫。 However I can't. 但是我不能。

@{
    ViewBag.Title = "Yönetim Giriş";
    Layout = "~/Views/Shared/_LoginLayout.cshtml";
    var a = Html.ValidationSummary(true, "Hatalı giriş. Lütfen tekrar deneyiniz.");
 }

I can get my validation summary with using var a . 我可以使用var a获得验证摘要。 I want to show this message in bubble or in message box. 我想在气泡或消息框中显示此消息。

-EDİT- -编辑-

<tr> <td align="right" colspan="2">
    @Html.DialogFormLink("Şifremi Unuttum", Url.Action("SifreUnuttum"), "Şifre Hatırlama", "ProfileContainer", Url.Action("Login"))
     <input type="submit" value="Log In" onclick="javascript:alert();" />
</td> </tr> </table>



<script>
    function alert(){
       alert(@Html.ValidationSummary(true, "Hatalı giriş. Lütfen tekrar deneyiniz."))
    }
</script>

You need to change name of you function: 您需要更改函数名称:

<script>
    function alert(){
       alert(@Html.ValidationSummary(true, "Hatalı giriş. Lütfen tekrar deneyiniz."))
    }
</script>

you named you function alert() which is function of alert window in js. 您将函数命名为alert(),它是js中的警报窗口的函数。 So you are making infinite loop for calls. 因此,您正在使呼叫无限循环。 You got stackoverflow :P 你有stackoverflow:P

use Ctrl+shif+J you can find js errors there 使用Ctrl + shif + J可以在其中找到js错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Jquery 验证 - 在急切验证期间显示验证摘要? - Jquery validation - show validation summary during eager validation? 使用jQuery如何验证各个元素并在“验证摘要”中显示相关的错误消息 - using jquery how do I validate individual elements and show the relevant error message in the Validation Summary MVC4:在表单或摘要上显示验证错误,而不是输入? - MVC4: Show validation error on the form or summary instead of an input? 当页面加载验证失败时,如何设置对验证摘要的关注 - How to set focus on validation summary when validation fails in page load jquery validate:如何显示和隐藏错误摘要? - jquery validate: How to show and hide error summary? 在MVC 2中使用JQuery进行验证摘要 - Validation Summary with JQuery in MVC 2 请参阅控制器中的验证摘要 - See the Validation Summary in the controller 如果验证摘要在javascript / Jquery中可用,如何隐藏div - How to hide a div if validation summary is available in javascript/Jquery ASP.NET,MVC4,Unobtrusive Validation - 在bootstrap手风琴中将错误摘要显示为叠加 - ASP.NET, MVC4 , Unobtrusive Validation - Show error-summary as overlay in bootstrap accordion 与该字段旁边的附加注释相比,如何显示单独的jQuery Validation消息框注释: - How to make a separate jQuery Validation messagebox note appear compared to an appended one next to the field: at the same time
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM