Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best way to display error/warning messages on website app?

I'm creating a website app(ASP.NET, C#) and I just want to know the best way to display error/warning messages. Is it better to do it by MessageBox or thru a Label? Just need some suggestions.

like image 382
Googler Avatar asked Oct 28 '11 12:10

Googler


2 Answers

I would prefer to do it in this way:-

 this.RegisterClientScriptBlock(typeof(string), "key",  string.Format("alert('{0}');", ex.Message), true);
like image 101
Rahul Tripathi Avatar answered Sep 28 '22 19:09

Rahul Tripathi


For server side validation, you can write a custom control (which I did) like this to display message consistantly through out the site.

enter image description here

For client side validation, you can use validation summary.

<asp:ValidationSummary ID="ValidationSummary1" runat="server" DisplayMode="List"
    ShowMessageBox="true" ShowSummary="false" />
like image 34
Win Avatar answered Sep 28 '22 20:09

Win