最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c# - How to implement Validation Controls with multiple submit buttons - Stack Overflow

programmeradmin0浏览0评论

There are two submit buttons on web form, Required field validation is there, i want if i click first submit button, it doesn't check the second submit. Mean i only want that only first text box Required validation must work? what should i have to do that i can segregate validation on multiple submit buttons For more detail, snap shot is included.

There are two submit buttons on web form, Required field validation is there, i want if i click first submit button, it doesn't check the second submit. Mean i only want that only first text box Required validation must work? what should i have to do that i can segregate validation on multiple submit buttons For more detail, snap shot is included.

Share Improve this question edited Aug 15, 2013 at 12:34 ulluoink 2,7852 gold badges17 silver badges22 bronze badges asked Aug 15, 2013 at 11:34 Abdul KhaliqAbdul Khaliq 2,2854 gold badges29 silver badges32 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 9

What you need is validationGroup property

The required Filed Validator will have following property

 <asp:requiredfieldvalidator id="RequiredFieldValidator2"
      ...
      validationgroup="Group1"
      ...
      runat="Server">
    </asp:requiredfieldvalidator>

And associated button

 <asp:button id="Button1" 
      text="Validate" 
      causesvalidation="true"
      validationgroup="Group1"
      runat="Server" />

In this way you can organise which validation to perform on any specific button click

发布评论

评论列表(0)

  1. 暂无评论