Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Client Script
Message
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Client Script
Versions des environnements
OS:
Windows XP
Database:
MS SQL Server
Divers
Thread ID:
01317676
Message ID:
01317676
Vues:
60
Hi everybody,

I need to be able to dynamically show the message. The code I'm trying to use is
protected void Form_ItemInserting(object sender, FormViewInsertEventArgs e)
    {        
        //make sure username is unique
        if (!Util.IsUsernameUnique((string)e.Values["UserName"], Profile.SiteID))
        {
            e.Cancel = true;
            string Text = ((string)e.Values["UserName"]) + " is already being used. Please try another username";
            string Script = string.Format("document.DisplayMessage(\"{0}\");", Text);
            this.ClientScript.RegisterClientScriptBlock(this.GetType(), "Message", Script, true);
        }
The problem is, I believe, with "document.DisplayMessage".

In the ASPX I have at the top:
<head runat="server">
    <title>Registration</title>
    <link href="/asb_includes/AutoSuggestBox.css" rel="stylesheet" type="text/css" />    
    <script type="text/javascript">
    var dv = document.getElementById("spnStatFrame");
    var Spn = document.getElementById("spnStat");
    
    function DisplayMessage(Message)
    {            
        dv.style.display = "inline";        
        Spn.innerHTML = Message;
        setTimeout("dv.style.display = 'none'", 300000);
    }
</script>
</head>
<body>
How can I invoke this script correctly?

Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform