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.
I would prefer to do it in this way:-
this.RegisterClientScriptBlock(typeof(string), "key", string.Format("alert('{0}');", ex.Message), true);
For server side validation, you can write a custom control (which I did) like this to display message consistantly through out the site.
For client side validation, you can use validation summary.
<asp:ValidationSummary ID="ValidationSummary1" runat="server" DisplayMode="List"
ShowMessageBox="true" ShowSummary="false" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With