Content Page Controls Disappear When I Click OK on Javascript Alert

Content Page Controls Disappear When I Click OK on Javascript Alert

am 23.01.2008 19:14:46 von e_spork

I am using Page.ClientScript.RegisterStartupScript to throw up a
Javascript alert box. When I click OK on the alert box, all the
controls on my page disappear and I don't understand why. I can View
Source in the browser and see all the controls so I know they are
there, yet they vanish once I click OK. This is happening on a
Content page. The browser is IE 6.0.2900 and I'm running it inside of
Visual Studio 2005.

My master page consists of nothing more than a couple of

s and a
ContentPlaceHolder. My content page contains a user control (.ascx)
and an Insert button. The user control is basically the UI for an
underlying business object which contains its own validation logic.
For testing purposes, I have coded the Page_Load method to throw up an
alert() box on any postback. Here's the code, in brief:

<%@ Page Language="C#" MasterPageFile="~/MasterPage.master"
AutoEventWireup="true" CodeFile="AddUser.aspx.cs"
Inherits="DesktopCl_AddUser" %>
<%@ MasterType TypeName="MasterPage" %>
<%@ Register Src="../ucDesktopClUser.ascx" TagName="ucDesktopClUser"
TagPrefix="uc1" %>

Runat="Server">

Add User





CausesValidation="True" CommandName="Insert"
Text="Insert" OnClick="InsertButton_Click">




- - - - - - - - - - - - - - - -

protected void Page_Load(object sender, EventArgs e)
{

if (IsPostBack)
{
string script = "alert(\" Test \");";
ClientScriptManager csm = this.ClientScript;
if (!csm.IsStartupScriptRegistered(this.GetType(),
"ErrorPopup"))
csm.RegisterStartupScript(this.GetType(),
"ErrorPopup", script, true);
}
{
DesktopClUser user = new DesktopClUser();
UcDesktopClUser1.User = user;
}

}

- - - - - - - - - - - - - - - -

This is the script emitted by RegisterStartupScript:



Why does clicking on the alert() box cause the controls to disappear?
Is this a browser issue?