Page.Valid保存按钮 [英] Page.Valid on the save button

查看:73
本文介绍了Page.Valid保存按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有办法保存不将数据提交到数据库的保存部分,并在保存时仍然触发所有验证器?我想这样做是因为我想向用户显示错误的位置,他们仍然可以保存数据以便以后再进行更正。我在保存按钮上将CauesValidation更改为Flase并保存,但验证不会触发。如何获得我需要的结果?

I want to know if there is a way to save not submit the data to a save part of the database and still fire all the validators when saving? I want to do this because I want to show the user where the errors are and they can still save there data to come back and correct it later. I changed the CauesValidation to Flase on the save button and it saves but the validations don't fire. How can I get the result I need?

推荐答案

如评论中所述 - 您应该使用服务器端验证...

开始用这个: http://msdn.microsoft.com/en-us/ library / 0ke7bxeh(v = vs.110).aspx [ ^ ]

---

另一种选择是使用AJAX回调(如jQuery ajax方法或变体) ),这将把用户数据发送到客户端(可能通过页面方法),即使验证阻止正常的后期...
As mentioned in the comment - you should use server side validation...
Start with this: http://msdn.microsoft.com/en-us/library/0ke7bxeh(v=vs.110).aspx[^]
---
An other option is using AJAX callback (like jQuery ajax method or variants), that will send user data to the client (via page method probably) even when validation blocks normal post-back...


服务器端验证使用Validator ..



Server Side validation Using Validator..

Page.Validate("ValidationGroup");
if (!Page.IsValid)
 {
  return;
 }
else 
 {
 //Your Code Goes Here
 }


这篇关于Page.Valid保存按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆