Overview:
This article explains how to show toastr alert message in role master page in it management system. we have started a new project for learning asp.net. The project name is IT Management System and given Youtube link IT Management System (IMS Session-5) The following steps here.๐๐ฅ
Download Project Code IMS Session-5
Step 1:
✍ Open Already Created IT Management System Project Folder Location
✍ It's open in visual studio
Step 2: Add Links in Header tag
<script type="text/javascript" src="//cdn.jsdelivr.net/jquery/1/jquery.min.js"></script>
<script type="text/javascript">
function success(msg) {
toastr.option = {
"debug": false,
"positionClass": "toast-top-center",
"Onclick":null
}
toastr.success(msg, "Success");
return false;
}
</script>
Step 3: Write C# code in role master page in asp.net C#
protected void btnSave_Click(object sender, EventArgs e)
{
int affect = 0;
try
{
adminBO.Role = txtboxrole.Text;
adminBO.Description = txtboxDescription.Text;
affect = objadminbal.InsertRole(adminBO);
if(affect > 0)
{
ScriptManager.RegisterStartupScript(this,typeof(Page),"Success","<script>success('Role is saved Successfully.!')</script>",false);
}
}
catch(Exception ex)
{
throw new Exception(ex.Message);
}
Step 4: Run the project
Final Output:

No comments:
Post a Comment