.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

ModelState.AddModelError Message Format

Posted By:      Posted Date: October 12, 2010    Points: 0   Category :ASP.Net

Is it possible to preserve formatting when adding error message text to be redisplayed on the form. I have some error messages that I need to preserve page breaks in. I have tried using '<br />', '<br>', '\n' 7 '&lt;br&gt;' but to no avail. The break symbol itself is always displayed.

i want my error messages to display like this



Error Message 1 Line 1


Error Message 1 Line 2

without displaying the <br> as text.

but instead I get the following;

Errors: <br>Error Message 1 Line 1<br>Error Message Line 2

 Any ideas?

View Complete Post

More Related Resource Links

Suggest controls for the data format shown in message.

Hi all,  I have to display data in following format in asp.net. Please suggest me the best suited control for the same. Any help with code, rather than just the control names would be much appreciated.thanks in advance.-Harshal Month Category Budget ($) Actual ($) Updated Budget ($) Completed August 2009 --> CMG0 --> -$22,294,000.00 $0.00 -$22,294,000.00 Y TOTAL: -$22,294,000.00 $0.00 -$22,294,000.00   September 2009 --> CMG0 --> $0.00 $0.00 $0.00 Y TOTAL: $0.00 $0.00 $0.00   October 2009 --> CMG0 --> $0.00 $0.00 $0.00 Y TOTAL: $0.00 $0.00

Format Message Box Problem!



How can I format a display message box. Actually I using following script for display successfully message.

msg = "Record Inserted Sucessfully!"

ClientScript.RegisterStartupScript(GetType(Page), "alert", "<script>alert('" & msg & "');</script>")

But I need some change here.i need to display a Challan number to user through message box like

msg = "Record Saved!" + "Your Challan No. is" + txtChallanNo.Text.ToString()


            ClientScript.RegisterStartupScript(GetType(Page), "alert", "<script language=JavaScript>alert('" & msg & "');</script>")


I need message box should display like following


Record Saved!Challan No. is:-100.


Is it possible?if not please suggest me suitable way.

Thanking you


Error while reading message framing format at position 0 of stream (state: ReadingUpgradeRecord)


While calling a WCF service(service is hosted as a windows service) from a client application, below exception is being thrown:

System.ServiceModel.Security.MessageSecurityException: The server rejected the upgrade request. ---> System.ServiceModel.ProtocolException: Error while reading message framing format at position 0 of stream (state: ReadingUpgradeRecord) ---> System.IO.InvalidDataException: More data was expected, but EOF was reached.   --- End of inner exception stack trace ---   --- End of inner exception stack trace ---  Server stack trace:   at System.ServiceModel.Channels.ConnectionUpgradeHelper.ValidateUpgradeResponse(Byte[] buffer, Int32 count, ClientFramingDecoder decoder)   at System.ServiceModel.Channels.ConnectionUpgradeHelper.InitiateUpgrade(StreamUpgradeInitiator upgradeInitiator, IConnection& connection, ClientFramingDecoder decoder, IDefaultCommunicationTimeouts defaultTimeouts, TimeoutHelper& timeoutHelper)   at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.SendPreamble(IConnection connection, ArraySegment`1 preamble, TimeoutHelper& timeoutHelper)   at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.DuplexConnectionPoolHelper.AcceptPooledConnection(IConnection connection, TimeoutHelper& timeoutHelper)  

Problem with WCF: Error while reading message framing format at position 13665 of stream (state: Rea



we're using the net.tcp binding, server is self-hosted.

One of our clients experience the following problem randomly appearing on each client couple of times a day:

System.ServiceModel.ProtocolException, System.ServiceModel, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089

Error while reading message framing format at position 13665 of stream (state: ReadingEnvelopeBytes)

The exception appears on the client. I analyzed the WCF trace of the server and there are no exceptions.

What can be the cause of the exception?

I'd really appreciate any help, because the client is in production and this brings lots of problems.


The format of a message during Web Synchronization was invalid error.

My merge replication isn't working properly when I try to replicate large amounts of data.  The error I receive is:

"The format of a message during Web synchronization was invalid. Ensure that replication components are properly configured at the Web server."

I've found related topics with some discussion about a problem with having a mix of .NET frameworks.  I will look into this and see if this is the case for me but if so I'm confused why the replication would be working for small amounts of data but not large amounts of data.

Gmail internal chat like message box

This article provides you with the multi-functional message box window through which the usability of the web-site or any web application increases.

.Configurable MessageBox window with AJAX Support
.can set maximum number of message boxes to be visible
.can define the auto reload time, for single message, for all messages or no reload
.can create messages through a single function call
.can define auto hide time for each messages

How To Set a Date Format In GridView Using ASP.NET 2.0

A very common desire is to set a column of a gridview to display just the month, day and year of a DateTime type. The problem is the by default, the HtmlEncode property of the boundfield attribute (
The problem is that if this field is enabled, you can not pass format information to the boundfield control. That is, if you try the following code, you will not get the desired result.

How to format and update GridView and DataGrid rows using JQuery

The behavior described in this question is as expected. When you set text of a cell in grid, it directly affects HTML that is going to be rendered. When you set text value of a cell, it means that you are setting innerText of the cell. The column that GridView creates for command fields (Edit, Delete and Select) are a (anchor) or button elements. So you can see what will happen if you set text value in that cell. It will wipe out those link or button controls and replace them with simple text string.

How to format datetime & date with century?

Execute the following Microsoft SQL Server T-SQL datetime, date and time formatting scripts in Management Studio Query Editor to demonstrate the usage of the multitude of temporal data formats available and the application of date / datetime functions.


Program for Format Conversion of An Image

.NET provides extensive support for image conversion. Any image can be processed from one format to another. Most common formats to which .NET have support for are .BMP, .EMF, .GIF, .ICO, .JPG, .PNG, .TIF and .WMF.

Get pixel format, raw format, property id list and property items image in VB.net - C#.net.

n this simple article you will learn that how we can get pixel format, raw format, property id list and property items image in VB and C#.net.

Get Pixel Format:

Image consists of pixels to get the format of the pixel we have a property named pixel format. This property returns an enumeration of pixel format. This enumeration tells the pixel format.

To demonstrate make a window application. Drag one button and a picture box on form.

Now write the following code on Button click event:

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

Format Generic List Bound to Gridview


I have a generic list of a custom type. The custom type has a string and double.

I'm binding the list to a gridview and it outputs everything fine.

I'm trying to format the double column into a currency format. It is in a template field as I'm calculating a running total. I pass the value to a function that returns a double and adds the current value to a running total which I will show in the footer.

The format is not changing to currency as expected when using String.Format("{0:c}", GetTotal(Convert.ToDouble(Eval("Amount"))))

Any ideas on what might be going on and how to fix this?


UpdatePanel is not a known element - message when upgrading to 1.0 ajax


It worked on one of my old pages.  I change the web.config, renamed all the <asp.

On some aspx page it doesn't recognize the updatepanel.  It only does on one page.  If I create a new aspx page with a different name - then it works.

Should I just create a new web project ajax - then copy all my code into there?  Or is there a way to get those old pages to recognize the new ajax controls?

replacing ok and cancel button of an alert message with YES an NO button in asp.net web application.


i want to replace ok and cancel button of an alert message with YES an NO button in asp.net web application.When a user will click yes the data will be saved in the database and if user clicks that will act as a reset button and do not save the data in database and the control will move with as usual to the redirect page.Any pointers will be highly appreciated.I am usin g C# language.

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!




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