验证组中的验证问题 [英] validation problem in validationgroup

查看:79
本文介绍了验证组中的验证问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们,我有一个页面,在这个页面我创建了一个验证组和两个按钮,如添加和保存,我的问题是我使用验证组添加按钮,它正常工作,如果我点击保存按钮所有验证工作没有验证组和我想验证组在保存按钮中工作

请帮助我

hi friends i have one page and in this page i create one validationgroup and two button like add and save and my problem is i use validationgroup in add button it work properly and wen i click save button all validation are working without validationgroup and i want to validiongroup are work in save button
pls help me

推荐答案

我认为点击按钮时会自动调用验证。所以同样的情况是,基于按钮点击调用所有验证,而不区分在特定按钮上分配的验证组。



其次,您正在使用ADD&SAVE同一页面上的按钮..看起来有点不合逻辑,因为添加和保存可以做同样的事情,将表格数据带到数据库或进行进一步处理,



而不是你可以使用添加和取消按钮,而不是你可以重定向页面取消按钮,以便添加按钮可以自动处理验证。



我也是这个领域的新手,所以只是分享我的经验,而不是专业知识,(因为没有太多... :()< br $> b $ b

但我希望它对你有用..



问候,
I think validations are called automatically when a button is clicked... So same is the case that all validations are getting called based on button click without discrimination of validation groups assigned on specific button..

Secondly you are using ADD & SAVE buttons on the same page.. it seems a bit illogical, as add and save could be doing the same thing, that taking the form data to database or for further processing,

Rather You can use Add & Cancel Button, and than you can redirect the Page over Cancel Button so that add button could automatically handle the validations.

I am also a new in this field, so just sharing my experience, not expertise, (coz dont have much... :( )

But I hope it will work for you..

Regards,


成功:



Make it:

<asp:textbox id="txtBox" runat="server" xmlns:asp="#unknown"></asp:textbox>
                              <asp:requiredfieldvalidator id="rfv1" runat="server" errormessage="Provide District" controltovalidate="txtBox" validationgroup="vCheck" xmlns:asp="#unknown"></asp:requiredfieldvalidator>

<asp:button id="btnAdd" runat="server" text="Add" onclick="btnAdd_Click" validationgroup="vCheck" xmlns:asp="#unknown" />


这篇关于验证组中的验证问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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