.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

ASP.NET: Selectively Enable Form Validation When Using ASP.NET Web Controls

Posted By:      Posted Date: August 21, 2010    Points: 0   Category :ASP.Net

Sometimes the extra controls that come with Visual Studio .NET can be a bit inflexible or they just don't provide enough functionality or flexibility for all situations. The ASP.NET form validation controls, while powerful and easy to use, require that the entire page be valid before it's submitted back to the server. Through the use of the new object-oriented features of Visual Basic .NET, it is possible to extend their functionality to overcome this limitation. This article tells you how and helps you decide when it's a good idea to keep validation on the client and when you'd be better off disabling it.

James M. Venglarik II

MSDN Magazine April 2002

View Complete Post

More Related Resource Links

Each AccordionPane with form containing controls with validation


Hey all,

I am using Accordion with multiple AccordionPane. Each AccordionPane has a form tag that contains asp controls such as dropdownlist and textboxes and buttons to submit or cancel. Each asp control has a requiredFieldValidator assign to it.  However when a i am in a particular AccordionPane to submit the form, the validator for other fields in other fields is highlighted preventing me from submitting.


Pleaseeee provide me with some assistance or light on what the problem is.  I have deadlines today.




C++ at Work: Form Validation with Regular Expressions in MFC


I thought I'd use this month's column to describe an interesting app I built using the RegexWrap library described in my article "Wrappers: Use Our ManWrap Library to Get the Best of . NET in Native C++ Code" in this issue.

Paul DiLascia

MSDN Magazine April 2005

Commerce with ASP.NET: Leverage the Authentication and Form Validation Features of ASP.NET to Bolste


If you're planning to build an e-commerce site, you'll be pleased to see that ASP.NET makes it easier than ever. Existing controls can be used and extended to add a great deal more functionality than you might expect. In this article, forms-based authentication is used to verify the identity of users and make certain areas of the site, such as the check-out page, inaccessible to unauthorized users. The power and flexibility of validation controls are demonstrated using the CustomValidator control to connect to a Web Service that verifies addresses. A shopping cart is then implemented in ASP.NET using the DataGrid, and finally, credit card authorization and billing are performed.

Jason Lefebvre and Robert Lair

MSDN Magazine August 2002

ASP.NET: Develop Polished Web Form Controls the Easy Way with the .NET Framework


Pre-built custom controls make application design easier and faster and allow you to maintain UI consistency. However, prepackaged controls can be big and slow, and are OS-specific. For those who don't want to use prepackaged controls, Visual Studio .NET provides controls for Web Forms similar to those found in Windows Forms, including label and textbox, and new additions such as the DataGrid, all of which you can customize. If you want to design your own controls, the .NET Framework provides inheritable classes that take care of all the nasty stuff you want to avoid, including page lifecycle, maintaining state across invocations, and browser detection. This article discusses these concepts, as well as eventing, rendering, and client-side scripting.

David S. Platt

MSDN Magazine June 2002

What is the easiest way to reset all the values of controls on a web form (vb.net) to their defaults


What is the easiest way to reset all the controls on a web form.  Can I set "veiw state" to false for all of the controls with one command, do a response-redirect to its own page, and set view state back to true.  What is the easiest way to do it.



How to set rule only on form validation success InfoPath 2007



I'm a newbie to InfoPath 2007. I am creating a from without code. Is there a way to set a Rule to the Submit Button which will be triggered only in the case of Form validation success ? can we make use of the "Set condition" to setup a expression  in the Rule, for this purpose. Still i have no idea how to come up with an expression for such purpose. Can someone please explain.

Enabling/disabling input controls in a form

I am writing a ASP.NET UserControl and I am trying to incorporate JQuery into this.
The control is a simple form with a few input fields (text, checkbox, select, radio).
The first element in the form is a checkbox. Upon clicking this checkbox I want the all the input elements in the form (except the checkbox control itself) to be enable/disable. I tried writing some of this code but my solution was not getting me anywhere.
Below is the ASP.NET form code. I'd appreciate the help with some code or pointers into what I am doing wrong.
 <asp:Panel ID="pnlInputControls" runat="server">
    <table style="width:100%;">
            <td style="width:50%">
                <asp:CheckBox ID="chkBenefitName" runat="server" Checked="true" TextAlign="Right" ClientIDMode="AutoID" style="padding:0 0 0

"Enable this Form to be filled out by using a browser" check box is grayed out when publishing InfoP

When I try to publish InfoPath form to a SharePoint site collection, "Enable this Form to be filled out by using a browser" check box is grayed. Also, I see the following warning message: This form template is br owser-compatible, but it cannot be browser-enabled on the selected site. This may be cased by one of the following reasons: -The server is not running InfoPath Forms Services. - The necessary features are not available on the site collection. The policy setting on the server does not allow user to browser -enabled Form templates. I have tried the following: 1. Deactivated and reactivated " office SharePoint Server Enterprise Site collection features" 2. Deactivated and reactivated " office SharePoint Server Enterprise Site features" 3. "Form Templates" document library exists and visible. 4. I am able to check the box in other site collections without any problems. 5. Ran the following stsadm commands: STSADM.EXE -o deactivatefeature -filename IPFSAdminLinks\feature.xml -url http://siteCollection -force STSADM.EXE -o deactivatefeature -filename IPFSSiteFeatures\feature.xml -url http://siteCollection -force STSADM.EXE -o deactivatefeature -filename IPFSWebFeatures\feature.xml -url http://siteCollection -force STSADM.EXE -o activatefeature -filename IPFSAdminLinks\feature.xml -url http://siteCollection -force STSADM.EX

Validation Controls Inside UpdatePanel

Hi All,If you use validation control, the base validator will render script WebForm_OnSubmit() to the page and add form onsubmit "onsubmit="javascript:return WebForm_OnSubmit();". This script is used to fire client side validation event.Now I have a listview inside updatepanel, when click edit button to fire the listview edit mode, the above validation script is just not rendered. How shall I work around with that? I need to customize the client validation event here.Thanks.

how to apply validation controls on Gridview which is created dynamically

 hi, i created a gridview with two columns and 8 rows dynamically. All the rows are empty and editable at runtime. I am giving column names for this grid from some other .aspx page by passing column names using querystring.Because i am using this grid for three different pairs of column names.  i would like to know how to apply Required Field Validator, Regular Expression Validator  and Range Validator on Gridview textboxes. So that by using those validators i want to validate user inputs. And i would also like to know how to add rows at runtime for this grid. I am using ASP.net 2.0 and C#.net for this.(Visual Studio 2005) The code i am using to create gridview is below. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="LoadData.aspx.cs" Inherits="LoadData" %>  <form id="form1" runat="server">  <div> <asp:GridView ID="GrdDynamic" runat="server" AutoGenerateColumns="False" ForeColor="#333333" BorderColor="GradientInactiveCaption" BorderStyle="Solid" style="z-index: 108; left: 24px; position: absolute; top: 13px">  <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />  <RowStyle BackColor="#EFF3FB"

this.controls.add - not always adding to parent form

My current code (snippet below) iterates through user info and adds the same custom control to a form based on how many "Meals" (1-6) the user has selected.  It appears that all even # controls (the second, fourth and sixth) are added to the previously added control, rather than the parent form, when I later try to dispose the controls by iterating through this.controls, only 1, 3 and 5 appear, the others appear as children to 1, 3 & 5. I've reduced controls size, etc. to make sure they're not overlapping (if that can force inheritence?) but no luck.  Anyone have suggestions on what to look at or other guidance? public void drawMealPanel(Meal m, int x, int y) { Controls.MealDisplay md = new Controls.MealDisplay(m); md.Name = m.name; md.Tag = m.id.ToString(); md.Left = x; md.Top = y; md.DragDrop += new System.Windows.Forms.DragEventHandler(this.MealView_DragDrop); md.DragEnter += new System.Windows.Forms.DragEventHandler(this.MealView_DragEnter); this.Controls.Add(md); }

mdi form sub controls transparency C#

Hey there! Im having a panel with 2 Textboxes and a picturebox with a round corner image. The Panel is transparent so that the picturebox gives a round corner background(see image link) Now, my problem ist, that i need a mdiclient as form, and now the panel transparency doesn't work anymore. Making the panel color like the background color will not work, because i use a gradient as mdiclient background. Hope anyone can help me and understand what im trying to tell you. Image: http://img801.imageshack.us/img801/5325/unbenanntrr.jpg Thanks in advance

Using UserName to enable disable access to InfoPath form fields

Hi Everyone, I have created a browser enable form in InfoPath and restrict certain fields depending on the official logged on User Name. Now this works most of the time but my problem has to do with the "case" of User Names for some of the site users. In most cases the User Name is an exact match but for some reason, some user's names are reported by SharePoint (the Welcome at top of screen) with some parts captilized. Example - my hidden filed on the form reports my user name as xrs_master but the Welcome up top says XRS_Master - and the fields act as though I am not the correct user and won't enable. On the other hand there are users who's user name matches the case exactly and all works fine. Why is SharePoint reporting the user name differently? And if this is the reason they don't match, how do I fix it? Any Ideas? Many thanks in advance for help!

How to identify new row in repeating table and repeating section of browser enable infopath form

Hello All,   I have Exp form that contain repeating table as well as repeating section. When i click insert new item it inset new row but i didn't got identification of that row. Is there is way to get identification of each row in repeating table as well as section.  Please help on this.  Thank you.

Validation on detailsview that contains both dynamic and standard controls?

I have a form that, originally, contained only dynamic controls. Validation worked perfectly, all in one spot.Today I changed three of the controls to cascading dropdown lists, two of them being required fields.After adding a RequiredFieldValidator for the two required fields, it's as though I have two separate validation events:1. Dynamic field validation - any errors show up in validation summary, and after all are resolved, no longer appear2. Required field validation - do not appear in validation summary until after all dynamic fields are validatedA user could press submit, and be alerted of one or more validation errors from the dynamic fields. Then, after resolving all those, the user would THEN see the RequiredFieldValidator messages in the validation summary. That would be understandably frustrating.Aside from using non-dynamic validation & RequiredFieldValidator for each field ... is there any way to have one validation sequence?Hope this makes sense.Thank you!

Enable/Disable controls in a td when checkbox is checked

hi,I have a table with 10 rows.Each row having 3 asp controls (checkbox,textbox and dropdownlist).on pageload all controls except checkboxes should be disabled and If we check any checkbox the controls(textbox and dropdownlist) in that row are should be enable.pls reply me.Thanks in Advance.

Form validation error

When i try and submit a form..this is the error i get "The form cannot be submitted because it contains validation errors. Errors are marked with a red asterisk (required fields) or a red, dashed border (invalid values)." But i cannot see any red dotted lines and all the required fields are populated as well. When i submit my form in preview mode of Infopath: this is the error i am getting: The form contains the following errors: Field or group: Value Error: Only positive integers allowed Please help and let me know if I am missing on anything here?
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend