65.9K
CodeProject is changing. Read more.
Home

Multiple form submittion with validator control in ASP.Net

starIconstarIconemptyStarIconemptyStarIconemptyStarIcon

2.00/5 (2 votes)

Jan 20, 2007

viewsIcon

27240

downloadIcon

173

This article provide you knowlege about how you can handle multiple form submittion in ASP.Net

Sample Image - Multiple_form_submittion.jpg

Introduction

In past I am not able to use two different section of form submit in ASP.Net 1.0 or 1.1using validation control. Now .Net Framework 2.0, it is possible to submit no of different section of form. On the other hand, in normal HTML we can place two or more form object for posting the data. Asp.Net can’t support the multiple form tag but there was different process to do same.

 
            <asp:Label  ID="lblUsername" 
                        AssociatedControlID="txtUsername" 
                        Text="User Name : "
                        Runat="server" />
            <asp:TextBox    id="txtUsername"
                            ValidationGroup="loginval"
                            runat="server"/> 
            <asp:RequiredFieldValidator 
                        ID="validator1" 
                        runat="server" 
                        Display="Dynamic"
                        ControlToValidate="txtUsername"
                        ValidationGroup="loginval"
                        Text="*(Required)" />


             <asp:Button id="btnSubmit"
                        ValidationGroup="loginval"
                        runat="server"
                        text="Login"
                        OnClick="onClick_btnSubmit" />    


Above code show you how you will perform the submit function each section respective validation control. For separating each section by “ValidationGroup” keyword, you can seen here I used “ValidationGroup” same for the textfield, validator control and button on which I will display the message. You can create multiple submittion for no of group submittion of data distinctly.