Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Content Page Controls Disappear When I Click OK on Javascript Alertbox

Reply
Thread Tools

Content Page Controls Disappear When I Click OK on Javascript Alertbox

 
 
e_spork@yahoo.com
Guest
Posts: n/a
 
      01-23-2008
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 <div>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" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">

<h1>Add User</h1><br />

<uc1:ucDesktopClUser ID="UcDesktopClUser1" runat="server" />
<asp:Button ID="InsertButton" runat="server"
CausesValidation="True" CommandName="Insert"
Text="Insert" OnClick="InsertButton_Click"></asp:Button>

</asp:Content>

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

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:

<script type="text/javascript">
<!--
alert(" Test ");// -->
</script>

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

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
error: Only Content controls are allowed directly in a content page that contains Content controls. hazz ASP .Net 6 06-09-2010 01:54 PM
Placing identical controls on to the page using the Placingholder control makes them disappear alun65@gmail.com ASP .Net 2 07-16-2007 06:54 PM
Editing any of gridviews on a page makes bound controls in datalist disappear. HP ASP .Net 0 11-30-2006 06:00 AM
Outlook Express Messages Disappear, Bookmarks in Internet Explorer Disappear rchrdcarlisle@NOTyahoo.com Computer Support 19 07-30-2006 09:41 PM
Controls toward bottom of long page disappear seanmayhew@gmail.com ASP .Net 1 03-09-2006 12:14 PM



Advertisments