- Open Alert.cs File which you have created inside the AppCode Folder.You can add the following piece of code in the Alert.cs file
- We need to show Alerts at various Events like incorrect username or password or compulsory fields are not provided during registration at that we can show an alert to user for this we have made this common class.It is a generic class and it can be used in any project and it can be called from any page without even creating the object as it is public static.
- Both Alert Class and Show Method are Public and Static which makes them accessible without creating object in all files of project
Alert.cs C# Code:
using System.Web; using System.Text; using System.Web.UI; ///
Calling Alert Class from Csharp Code
Alert.Show("Incorrect UserName/Password ");Here we just have to pass the Message in the form of String and it will show the alert