473,395 Members | 2,467 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

javascript popup window not being shown

Hi friends,
I was writing an application to test how I could access web server control
in the client side javascript. I am trying to create a popup which would
contain the value of the button control. The code i wrote is as follows.

the aspx file
<code>
<%@ Page language="c#" Codebehind="StepByStep2_3.aspx.cs"
AutoEventWireup="false" Inherits="_315C02.StepByStep2_3" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>StepByStep2_3</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
<script language="javascript">
function btnSubscribe_ClientClick()
{
alert(document.StepByStep2_3.btnSubscribe.value + " You Suceeded");
}
</script>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="StepByStep2_3" method="post" runat="server">
<asp:Button id="btnSubscribe" style="Z-INDEX: 101; LEFT: 64px; POSITION:
absolute; TOP: 40px"
runat="server" Text="Button"></asp:Button>
</form>
</body>
</HTML>
</code>

the .aspx.cs file
<code>
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace _315C02
{
/// <summary>
/// Summary description for StepByStep2_3.
/// </summary>
public class StepByStep2_3 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button btnSubscribe;

private void Page_Load(object sender, System.EventArgs e)
{

}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnSubscribe.Click += new
System.EventHandler(this.btnSubscribe_Click);
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion

private void btnSubscribe_Click(object sender, System.EventArgs e)
{
btnSubscribe.Attributes.Add("OnClick","btnSubscrib e_ClientClick();");
}
}
}
</code>

What do u think went wrong?
thanks
Nov 19 '05 #1
2 1134
your code behind only renders the client onclick handler when the button is
clicked. so you need to click the button, wait for re-render, then click
again.

-- bruce (sqlwork.com)

"HelpSeeker" <He********@discussions.microsoft.com> wrote in message
news:32**********************************@microsof t.com...
Hi friends,
I was writing an application to test how I could access web server
control
in the client side javascript. I am trying to create a popup which would
contain the value of the button control. The code i wrote is as follows.

the aspx file
<code>
<%@ Page language="c#" Codebehind="StepByStep2_3.aspx.cs"
AutoEventWireup="false" Inherits="_315C02.StepByStep2_3" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>StepByStep2_3</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
<script language="javascript">
function btnSubscribe_ClientClick()
{
alert(document.StepByStep2_3.btnSubscribe.value + " You Suceeded");
}
</script>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="StepByStep2_3" method="post" runat="server">
<asp:Button id="btnSubscribe" style="Z-INDEX: 101; LEFT: 64px; POSITION:
absolute; TOP: 40px"
runat="server" Text="Button"></asp:Button>
</form>
</body>
</HTML>
</code>

the .aspx.cs file
<code>
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace _315C02
{
/// <summary>
/// Summary description for StepByStep2_3.
/// </summary>
public class StepByStep2_3 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button btnSubscribe;

private void Page_Load(object sender, System.EventArgs e)
{

}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnSubscribe.Click += new
System.EventHandler(this.btnSubscribe_Click);
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion

private void btnSubscribe_Click(object sender, System.EventArgs e)
{
btnSubscribe.Attributes.Add("OnClick","btnSubscrib e_ClientClick();");
}
}
}
</code>

What do u think went wrong?
thanks

Nov 19 '05 #2
Hi bruce,
Thanks for going thru such a huge code. And I do understand what u say. I
tried waiting for some time and clicking it again. But it didnt work. I
thought may be because it would try to execute both the client side code and
the server side btnSubscribe_Click() function. Then i inlcuded the line
alert(document.StepByStep2_3.btnSubscribe.value + " You Suceeded");
in the Page_Load(). And removed the btnSubscribe_Click() function. Even then
the pop up doesnt show up.
What do u think is the problem?
Thanks

"Bruce Barker" wrote:
your code behind only renders the client onclick handler when the button is
clicked. so you need to click the button, wait for re-render, then click
again.

-- bruce (sqlwork.com)

"HelpSeeker" <He********@discussions.microsoft.com> wrote in message
news:32**********************************@microsof t.com...
Hi friends,
I was writing an application to test how I could access web server
control
in the client side javascript. I am trying to create a popup which would
contain the value of the button control. The code i wrote is as follows.

the aspx file
<code>
<%@ Page language="c#" Codebehind="StepByStep2_3.aspx.cs"
AutoEventWireup="false" Inherits="_315C02.StepByStep2_3" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>StepByStep2_3</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
<script language="javascript">
function btnSubscribe_ClientClick()
{
alert(document.StepByStep2_3.btnSubscribe.value + " You Suceeded");
}
</script>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="StepByStep2_3" method="post" runat="server">
<asp:Button id="btnSubscribe" style="Z-INDEX: 101; LEFT: 64px; POSITION:
absolute; TOP: 40px"
runat="server" Text="Button"></asp:Button>
</form>
</body>
</HTML>
</code>

the .aspx.cs file
<code>
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace _315C02
{
/// <summary>
/// Summary description for StepByStep2_3.
/// </summary>
public class StepByStep2_3 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button btnSubscribe;

private void Page_Load(object sender, System.EventArgs e)
{

}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnSubscribe.Click += new
System.EventHandler(this.btnSubscribe_Click);
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion

private void btnSubscribe_Click(object sender, System.EventArgs e)
{
btnSubscribe.Attributes.Add("OnClick","btnSubscrib e_ClientClick();");
}
}
}
</code>

What do u think went wrong?
thanks


Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jeannie | last post by:
I have a popup window which is a slideshow of about 7 images. When the popup window loads, the first image is present and then the viewer can select next or previous to scroll through the rest of...
3
by: annon | last post by:
I've noticed that some problems come up frequently that are of importance in writing web pages, because they're pretty fundamental points. For general reference, here are some collected...
14
by: tshad | last post by:
I posted this on the asp.net group, also. I wasn't sure whether this was an asp.net problem or a javascript problem. I have a page that was originally created from a program I found on the net...
9
by: Robby Bankston | last post by:
I'm working on some code and am running into brick walls. I'm trying to write out Javascript with Javascript and I've read the clj Meta FAQ and didn't see the answer, read many similar posts (with...
3
by: Alex | last post by:
Hi, I'm having some trouble implementing a popup in firefox. I attached some simplified code at the bottom. This is part of a firefox extension. What happens is that a popup window is created,...
12
by: Mark Fox | last post by:
Hello, I am attempting to do something very simple. I have a page MainPage.aspx and a popup window Popup.aspx. When users click on the linkbutton in the popup window I am looking to do some...
9
by: tshad | last post by:
This is from my previous post, but a different issue. I have the following Javascript routine that opens a popup page, but doesn't seem to work if called from an asp.net button. It seems to work...
17
by: korund | last post by:
What is correct syntax for the following scenario: show five alerts, one by one(text different), when page loads in browser -on body onload: alert(text 1) alert(text 2) alert(text 3)...
4
by: E | last post by:
I am having trouble with setTimeout working on a second call to the setTimeout function from a second page which is an html page. Here is the scenario. I have a web page and onload it calls a...
3
by: Yisehaq | last post by:
Hi guys I am trying to prepare few html pages which contain OLAP cubes on a CD. The problem I have is that the popup blocker blocks the OLAP modules from being shown. Therefore, I wanted to write...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.