Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
sir, here is my function that i am using for messagealert in vb.net...

VB
Imports Microsoft.VisualBasic
Namespace Amit
    Public Class Messagebx
        Public Shared Sub Alert(ByVal cont As Web.UI.Control, ByVal msg As String)
            Dim scrpt As String = String.Format("alert('{0}');", msg)
            ScriptManager.RegisterStartupScript(cont, cont.GetType(), "Myscript", scrpt, True)

        End Sub
    End Class
End Namespace




it is show a normal messagebox.. i want to use some msgbox css to make it stylish.. how can i use css in that code. or use style.
Posted
Updated 12-Jul-14 3:09am
v2

1 solution

Instead of writing alert you can use jquery ui dialog for stylish dialog box for this add jquery and jquery UI with css.
Code is below:

create a method like this in javascript and
C#
function ShowAlert(message) {
                 $("#dialog").html(message);
      $("#dialog").dialog({
          modal: true,
          title: "Status"
      });
  }

In Codebehind :
C#
string message = "Set Message Here";
Page.ClientScript.RegisterStartupScript(this.GetType(), "popup", "ShowAlert('" + message + "');", true);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900