473,398 Members | 2,125 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,398 software developers and data experts.

passing a parameter to pop up window by javascript how?

how to let javascript code understand txtUser.Text?
in
window.open("WebForm26.aspx?User=txtUser.Text",... ..................)
Nov 19 '05 #1
8 9013
If you use ASP.NET, you can move the entire Javascript to the server side by
using
Page.RegisterStartupScript, and then all server-side variables are available
to be passed to Javascript.

Ryan

"Bishoy George" wrote:
how to let javascript code understand txtUser.Text?
in
window.open("WebForm26.aspx?User=txtUser.Text",... ..................)

Nov 19 '05 #2
On Mon, 26 Sep 2005 22:16:25 +0300, Bishoy George wrote:
how to let javascript code understand txtUser.Text?
in
window.open("WebForm26.aspx?User=txtUser.Text",... ..................)

Use
window.open("WebForm26.aspx?User=<%=txtUser.Text%> ",.....

Nov 19 '05 #3
Could you give me an example please?
still I can't send a parameter through javascript
window.open("url.aspx?---- = ----"); // VERY IMPORTANT to me

Also:
Can I write my C# code in the code behind page and just calling a javascript
method by this way?

"Call Javascrip from the server side" <Call Javascrip from the server
si**@discussions.microsoft.com> wrote in message
news:DF**********************************@microsof t.com...
If you use ASP.NET, you can move the entire Javascript to the server side
by
using
Page.RegisterStartupScript, and then all server-side variables are
available
to be passed to Javascript.

Ryan

"Bishoy George" wrote:
how to let javascript code understand txtUser.Text?
in
window.open("WebForm26.aspx?User=txtUser.Text",... ..................)

Nov 19 '05 #4
On Mon, 26 Sep 2005 23:46:52 +0300, Bishoy George wrote:
Could you give me an example please?
still I can't send a parameter through javascript
window.open("url.aspx?---- = ----"); // VERY IMPORTANT to me

Also:
Can I write my C# code in the code behind page and just calling a javascript
method by this way?

"Call Javascrip from the server side" <Call Javascrip from the server
si**@discussions.microsoft.com> wrote in message
news:DF**********************************@microsof t.com...
If you use ASP.NET, you can move the entire Javascript to the server side
by
using
Page.RegisterStartupScript, and then all server-side variables are
available
to be passed to Javascript.

Ryan

"Bishoy George" wrote:
how to let javascript code understand txtUser.Text?
in
window.open("WebForm26.aspx?User=txtUser.Text",... ..................)

The Page.RegisterStartupScript points to a code behind way to do it. The
other way is using inline <%= txtUser.Text %> which is very convenient and
direct.
Nov 19 '05 #5
still doesn't work!!!
------------------------------------------this is my aspx
page ---------------------------------------------------------
<%@ Page language="c#" Codebehind="WebForm25.aspx.cs"
AutoEventWireup="false" Inherits="WebApplication1.WebForm25" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm25</title>
<script language="javascript">
function PopUp()
{
window.open("WebForm26.aspx?User=<%=txtUser.Text%> ","popupWin","toolbar=0,
location=0, status=0, menubar=0, scrollbar=0, resizable=0, width=600,
height=400, left=50, top=50",true);
}
</script>
<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">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:Label id="lblUser" style="Z-INDEX: 101; LEFT: 24px; POSITION:
absolute; TOP: 48px" runat="server"
Width="80px" Height="22px">User Name:</asp:Label>
<asp:TextBox id="txtUser" style="Z-INDEX: 102; LEFT: 112px; POSITION:
absolute; TOP: 48px" runat="server"
Width="176px" Height="22px"></asp:TextBox>
<INPUT id="btnCheck2" style="Z-INDEX: 103; LEFT: 304px; WIDTH: 128px;
POSITION: absolute; TOP: 48px; HEIGHT: 32px"
type="button" value="Check!" name="btnCheck2" onclick="PopUp();">
<asp:Button id="btnCheck" style="Z-INDEX: 104; LEFT: 304px; POSITION:
absolute; TOP: 96px" runat="server"
Width="128px" Height="32px" Text="Check!"></asp:Button>
<asp:Label id="lblCheck" style="Z-INDEX: 105; LEFT: 440px; POSITION:
absolute; TOP: 104px"
runat="server" Width="184px" Height="32px"></asp:Label>
<asp:RequiredFieldValidator id="RequiredFieldValidator1" style="Z-INDEX:
106; LEFT: 144px; POSITION: absolute; TOP: 72px"
runat="server" Width="96px" Height="8px" ErrorMessage="User Name
Missing!" ControlToValidate="txtUser">Required
Field!</asp:RequiredFieldValidator>
</form>
</body>
</HTML>

--------------------------------------this code
behind-----------------------------------------------------------------
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 WebApplication1

{

/// <summary>

/// Summary description for WebForm25.

/// </summary>

public class WebForm25 : System.Web.UI.Page

{

protected System.Web.UI.WebControls.Label lblUser;

protected System.Web.UI.WebControls.Button btnCheck;

protected System.Web.UI.WebControls.Label lblCheck;

protected System.Web.UI.WebControls.RequiredFieldValidator
RequiredFieldValidator1;

protected System.Web.UI.WebControls.TextBox txtUser;
private void Page_Load(object sender, System.EventArgs e)

{

// Put user code to initialize the page here

}

#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.btnCheck.Click += new System.EventHandler(this.btnCheck_Click);

this.Load += new System.EventHandler(this.Page_Load);

}

#endregion

private void btnCheck_Click(object sender, System.EventArgs e)

{

lblCheck.Text = "You selected " + txtUser.Text;

}

}

}
Nov 19 '05 #6
-----------------------WebForm26.aspx-----------------------
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 WebApplication1

{

/// <summary>

/// Summary description for WebForm26.

/// </summary>

public class WebForm26 : System.Web.UI.Page

{

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

{

// Put user code to initialize the page here

string userString = Request.QueryString["User"];

Response.Write("You selected " + userString);

}

#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.Load += new System.EventHandler(this.Page_Load);

}

#endregion

}

}
Nov 19 '05 #7
window.open("WebForm26.aspx?User="+document.getEle mentById("txtUser").value,
......................)

Eliyahu

"Bishoy George" <bi****@bishoy.com> wrote in message
news:uV**************@TK2MSFTNGP09.phx.gbl...
how to let javascript code understand txtUser.Text?
in
window.open("WebForm26.aspx?User=txtUser.Text",... ..................)

Nov 19 '05 #8
Thank you , it worked now. You are brilliant.

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:Or**************@TK2MSFTNGP10.phx.gbl...
window.open("WebForm26.aspx?User="+document.getEle mentById("txtUser").value,
.....................)

Eliyahu

"Bishoy George" <bi****@bishoy.com> wrote in message
news:uV**************@TK2MSFTNGP09.phx.gbl...
how to let javascript code understand txtUser.Text?
in
window.open("WebForm26.aspx?User=txtUser.Text",... ..................)


Nov 19 '05 #9

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

Similar topics

3
by: Raju V.K | last post by:
can I use javascript and PHP in the following manner to create a pop-up window: <--- in <head> </head> <script language=javascript> function popup(folder1, file1) {...
29
by: wayne | last post by:
Hey there... I'm having some problems passing url parameters with an open.window command. I'm not terribly familiar with java script but here is the code below. When executed it opens the...
7
by: Oleg Konovalov | last post by:
Hi, I am trying to pass a bunch of checked checkboxes (Javascript array) from page1 to the Java action class on subsequent web page (page2). (on page 1 I have a bunch of DB rows with a checkbox,...
4
by: allanrodkin | last post by:
Hi, I'm designing a website in dreamweaver and I'm using JavaScript to slide text across the page. The text is contained in <div> tags. I have designed a function which can move two of the div...
5
by: sfeher | last post by:
Hi All, I need to call a function(loaded with appendChild) for which I have the name as a string. .... var fnName = 'fn1'; var call = fnName + '('+ param +' )'; eval(call);
1
by: Carlos Aguayo | last post by:
If I have a parent and a child window, and if I create an array in the child window, and pass it as a parameter to the parent window, it's still an array, and its methods still work (like the...
4
by: simon | last post by:
hi, I would like to separate my javascript completely from my xhtml. in the end there should be only <script type="text/javascript" src="javalib.js"></script> in the head-tag to my javascript....
6
by: vncntj | last post by:
I have this home.js file and I'm trying to collect the values on the other at "emplist.aspx" function poponload() { testwindow= window.open ("emplist.aspx", "mywindow",...
1
by: Ron | last post by:
Hi, I'm using javascript to dynamically generate a table (ajax/xml). What I want to achieve is when a table cell is clicked it needs to call a function and pass the event as a parameter (In IE I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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.