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

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

Adding New Error Message to Validation Summary Control

Posted By:      Posted Date: September 22, 2010    Points: 0   Category :ASP.Net


 In the code behind based on a condition i want to add a error message to the Validation Control.

 I tried the below.

 'Call function to add error message.
protected void AddErrorToValidationSummary(string errorMessage)
 CustomValidator custVal = new CustomValidator();   
 custVal.IsValid = false;   
 custVal.ErrorMessage = errorMessage;  
 custVal.EnableClientScript = false;   
 custVal.Display = ValidatorDisplay.None;        



View Complete Post

More Related Resource Links

Localize framework message from xml validation error


I need to validate an XML through XSD. I am using XMLReader (with XmlReaderSettings and 

Validation_EventHandler to do it). Depend on users preference, I would like to change the output message generated by  Validation_EventHandler in french or english.

Any idea on how to perform this?





Adding Oracle table into SSIS project --Oracle error occurred, but error message could not be retrie

Hi all I am new to design SSIS packages,to day I stated creating package SSIS package and adding the Tables,while adding tables,one of the table giving an below error . I verified the table structure it has one "CLOB" datatype. can some body help how to add this table( whole idea of the package is I have Dump those tables with structure and Data to SQL Server 2008 Database)  =================================== Oracle error occurred, but error message could not be retrieved from Oracle. Data type is not supported. (Microsoft Visual Studio) ------------------------------ Program Location: at System.Data.OleDb.OleDbCommand.ProcessResults(OleDbHResult hr) at System.Data.OleDb.OleDbCommand.PrepareCommandText(Int32 expectedExecutionCount) at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) at System.Data.OleDb.OleDbCommand.ExecuteDbDataReader(CommandBehavior behavior) at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior) at Microsoft.DataWarehouse.Design.DataSourceConnection.FillDataSet(DataSet dataSet, String schemaName, String tableName, String tableType) at Microsoft.AnalysisServices.Design.DataSourceDesigner.AddRemoveObjectsFromDSV() Thanks in Advance.   SNIVAS

jquery validation error message - place in the specified div whose class is putmehere !



I decided to use jquery validations because asp.net validation controls are so crazy inside the update panel.

But I need to plase the error messages in the specified div whose class is putmehere ! I am unable to do that. here is my code;

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
    <script src="../JQuery/jquery-1.4.2.js" type="text/javascript"></script>
    <script src="../JQuery/Validation/jquery.validate.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function() {
                rules: {
                    <%=TextBox1.UniqueID %>: {
                        minlength: 2,
                        required: true
                     <%=TextBox2.UniqueID %>: {                       
                        required: true,
                }, messages: {
                    <%=TextBox1.UniqueID %>:{
                        required: "* Required Field *",
                        minlength: "* Please enter atleast 2 characters *"

validation control in datalist error


hi guys,

i'm having some problem with my validation control that i put inside my datalist template. the purpose of the validation is to ensure that user enter only integer at the textbox inside the datalist. however, if there is more that 1 record/row at the datalist and i enter the integer only in one of the textbox at a specific row, the validation control ask me to enter a value for the other datalist record when i press the button. so my question is, is there a way to make sure that the validation control only check the specific textbox at the specific row?? i tried editing the properties of the validation control but i cannot find anything that is relevant...

Your help is greatly appreciated!!

Thank you in advance


Page IS Valid Validation Error and Message Box Pops up twice which is annoying???




i have a create User Wizard with a Custom Template so I can grab more information from the user who is

registering on my page.  When they click the submit button a window modal popup extender pops up using Javascript code to

show them the Form is being processed.


createUserWizard Submit Button

  <asp:Button ID="StepNextButton" runat="server"  CommandName="MoveNext"  OnClientClick="ShowMP();" align="middle" CausesValidation="False"
                                            Text="Submit my Profile"  />


Javascript code<

Error in adding new link in summary link webpart after upgrading to sharepoint 2010



I have a weird error after upgrading my portal from sharepoint 2007 to sharepoint 2010 using attach database approach.

The error occurs when creating a new link in the summary link web part, so a pop up screen will show up, then if I click on Browse Button to link for an item an error occur, on the other hand if i click Browse Button to link an image then everything is working normally.

I checked the event viewer and here what I got, any Ideas?

Event code: 3005

Event message: An unhandled exception has occurred.

Event time: 23/10/2010 3:44:56 PM

Event time (UTC): 23/10/2010 12:44:56 PM Event ID: b74e380e0f6c4d3499feae1176557bcd Event sequence: 403 Event occurrence: 5 Event detail code: 0


Application information:

Login control displays error message even after successful login... How come?



I am using .net framework 2.0 witn C#. Am using the login and the CreateUserWizard and the situation is like this.

1) login.aspx page has the login control and i have a hyperlink on the same page saying 'sign up now' which when clicked redirects to the register.aspx page where i have place the createUserWizard control

2) As a new user i click on the 'sign up now' and register myself.

3) I come back to the login.aspx page and login with my new username & password.

It displays the following message 'Your login attempt was not successful. Please try again' although it is successful. How do i know this?? I placed the 'Login Name' control over the top of my page where its displaying the username with which i logged in.

i.e it displays the error msg and my user name ( which means my login was successful right?)

4) Apart from this when i logout and try to login again with the same username it displays the same error msg BUT this time it really does not login in. That username & password does not work anymore and i have to create a new one and its a cycle again from Step2.

Where am i going wrong?

How to localize "field is required" validation error message in mvc musicstore sample

I tried to localize codeplex mvc musicstore sample in .NET 3.5
I replaced "field is required"  message in all files with localized text.

In login of register screen, if some fields are empty, pressing enter still shows english language text like

The UserName field is required.

How to localize this validation message ?


WebBrowser control error message page handling




I have WebBrowser control on my winform. When I try navigate to some web-site I get standard IE error pages like:

  • "Navigation to the webpage was canceled"
  • "The address is not valid"
  • "Page couldn't be loaded"
  • etc.

I need to handle these errors and return custom error message to user. Is there any way to solve this issue?

I know about NavigateError event from the OLE DWebBrowserEvents2 interface. I implemented it. But when some navigation error occures I need stay at page from which user tried navigate (CanGoBack property returns false if it's first page).

Is it real? How?



Throws an error message while adding users to the Active Directory


Hello guys,

I am trying to add a user to active directory but for some reason its failing


Here is the error message

Message: HandlingInstanceID: dde791c2-7df4-4214-85c4-72b045510def

An exception of type 'System.Runtime.InteropServices.COMException' occurred and was caught.


05/04/2011 15:18:30

Type : System.Runtime.InteropServices.COMException, mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089

Message : The server is not operational.

Source : System.DirectoryServices

Help link :

ErrorCode : -2147016646

Data : System.Collections.ListDictionaryInternal

TargetSite : Void Bind(Boolean)

Stack Trace : at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)

at System.DirectoryServices.DirectoryEntry.Bind()

at System.DirectoryServices.DirectoryEntry.get_IsContainer()

at System.DirectoryServices.DirectoryEntries.CheckIsContainer()

at System.DirectoryServices.DirectoryEntries.Add(String name, String schemaClassName)



Adding Dynamic Rows in ASP.NET GridView Control with TextBoxes and with Delete functionality

In my previous examples, I have demonstrated on how to add dynamic rows in GridView control with TextBoxes and how to save the values into the database. Now, seems that most of the developers are asking if how to add a delete functionality with it. So in this example, I'm going to show on how to delete a certain row in the dynamic GridView with TextBoxes.

Server side validation of Fileupload control not working



I've tried this method in my code behind to try and validate that the Fileupload control has a file or not. I get the error message the the event "Server Validate" cannot be found. Can anyone tell why? Thanks.

Public Sub CustomValidator1_ServerValidate(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles CustomValidator1.ServerValidate

' Get file name

        Dim uploadAvatar As FileUpload = DirectCast(AdvertisementForm.FindControl("uploadAvatar"), FileUpload)

        Dim UploadFileName As String = uploadAvatar.PostedFile.FileName

        If UploadFileName = "" Then
            ' There is no file selected
            args.IsValid = False
            Dim Extension As String = UploadFileName.Substring(UploadFileName.L

Inserting personal error message in ValidationSummary



I am creating a web form that requires a lot of validation. I use many of the validation control in asp.net already like RequiredFieldValidator and CompareValidator. 

My Problem: after my custom validation for the value entered return an error message, and I pressed enter key when the field is empty, my custom error message is overlapped by my ValidationSummary. 

Setting my custom error to visible = false on button click also does not seem to work as it requires for me to enter the value first.

This made me think, is there a way to insert my custom validation inside the ValidationSummary as an error message like for other validation control?

Thanks in advance

Adding new items to a Repeater control with transitions?



I am currently in the process of writing a facebook type 'activity feed' for a site. Currently I am binding the last 10 items to a repeater control, which contains a usercontrol representing each item. This works fine but there are a couple of requiremnts that are giving me problems and wondered if the the good people of the forum could make some suggestions.

The requirement is that when a user clicks a refresh button any new events are added to the top of the list, the previous items drop down and the equivalent number of old items drop off the bottom, all with nice slider transitions.

I have put the repeater inside of an update control and are able to handle the transitions by using RegisterStartup script to drop jquery calls onto the page for the slider. However I cannot find a way to dynamically add or remove new datarows to the repeater. I need the old items to stay in the repeater and be pushed down by the new items, so completely refreshing the datasource seems like a bad idea.

I was thinking about maybe storing the datasource in the viewstate and adding rows to that, maybe with an extra column on the end which stores what transition is needed on the databind for my jquery, but there will be a 'View more items' link at the bottom of the page, so I am worried that the list could get pretty large and there

create user wizard login error message dont show in a message box?




i am using create user wizard and capturing other information within content template when a new user

registers. Some of the textboxes are binded to required field validators.


there is a validation control on the page and ShowMessage box is True.

If they dont complete some of the text boxes then the message box pops Up with the error message.

It does not however include information errors like "User already exists" or Email address already exists

from the create user wizard membership  UserName and Password Textboxes


is it possilbe to hook all of these up so I get one message box with all errors including membership ones?




Very Basic Question - Error message running first page


Hi Everyone,

I am running Windows 7 and I have gone into Control Panel and activated all of the IIS Functions.

The web application I am running was downloaded from the net (and has worked on other machines previously).  Once I downloaded it, I moved it into C:/inetpub/wwwroot/code/main.asp

I am a bit of a novice at this!  But I am hoping someone can point me in the right direction!


I get the following error when I try and run the web application through IE:

"An error occurred on the server when processing the URL. Please contact the system administrator. If you are the system administrator please click here to find out more about this error."

(When i click the "click here" button it just goes to the IIS site).


Appreciate any help I can get!




Custom Control Design-Time SiteMap Provider Error


Greetings - I was referred here by MSDN forums hope this is the right place -  

I have a custom control (:WebControl) that renders web.sitemap in a specific way. While it runs error free and produces the expected result, at Design-Time it complains

Error Creating Control - MyControl  The provider 'AspNetXmlSiteMapProvider' specified for the defaultProvider does not exist in the providers collection.

I have discovered that the error is cause by this line of code:

string div = string.Format("<div class='{0}' id='{1}'>{2}</div>", this.CssClass, this.ID.ToString(), EnumerateNodesRecursive(SiteMap.RootNode, level));

or more specifically, by the reference to SiteMap.RootNode - I am not clear what is missing thoough because I have configured the SiteMapProvider in web.config as this:

        <add name="AspNetXmlSiteMapProvider" 
             type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 
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