Remove URL of JavaScript alert box in Google Chrome using C# and VB.Net

Last Reply 3 months ago By pandeyism

Posted 3 months ago

If it is possible to remove the message "This Page at https://salesforce.com Says" from the pop up page in Google Chrome.

Dim message As String

message = "alert('Kolom Propinsi belum dipilih !')"
ScriptManager.RegisterClientScriptBlock(TryCast(sender, Control), Me.GetType(), "alert", message, True)

 

You are viewing reply posted by: pandeyism 3 months ago.
Posted 3 months ago

Hey arie.keren,

You can't change the JavaScript alert box header name. But instead you can use JQuery dialog .

Please refer below sample.

HTML

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/jquery-ui.js" type="text/javascript"></script>
<link href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/themes/blitzer/jquery-ui.css"
    rel="stylesheet" type="text/css" />
<script type="text/javascript">
    function ShowPopup(message) {
        $(function () {
            $("#dialog").html(message);
            $("#dialog").dialog({
                title: "jQuery Dialog Popup",
                modal: true
            });
        });
    };
</script>
<div id="dialog" style="display: none">
</div>

Code

C#

protected void Page_Load(object sender, EventArgs e)
{
    string message = "Kolom Propinsi belum dipilih !";
    ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ShowPopup('" + message + "');", true);
}

VB.Net

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
    Dim message As String = "Kolom Propinsi belum dipilih !"
    ClientScript.RegisterStartupScript(Me.[GetType](), "Popup", "ShowPopup('" & message & "');", True)
End Sub

Screenshot