0

Good day, I need help.

I would like to pass values from one aspx page textbox to another aspx page textbox.

I'm editing the pages & adding code (so no clue what i'm doing) i thought of javascript but no luck on passing the value to the next pages textbox.

On the 1st aspx page textbox1 onclick button go to another aspx page passing the value of the 1st Page Textbox1 = 2nd Page Textbox2

Page1 Apsx
<input type="text" text="Textbox1" id="Textbox1" value="">
<button to call 2 page passing the value>

Page2 Aspx
<input type="text" text="Textbox2" id="Textbox2" value="VALUE OF PAGE1 TEXTBOX1">

Please assist & provide code to send & define the var for second page

Regards

3
Contributors
4
Replies
8
Views
8 Years
Discussion Span
Last Post by ismailc
0

Hi,
You can do it using sessions.

in the first page add the textbox1 value to a session variable in the onclick event

session["tb1"]=textbox1.value;


in the second page assign the value in the session variable to textbox2 in Page_Load

textbox2.value=session["tb1"];

u dont need to pass the value to the second page and place runat="server" in the input tags.


thankyou

0

Thanks for assisitng but i'm not working in the application, i think VS2005 C#.

My page looks like:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >

<html>
<head runat="server">
<title>myAdvancedTracking</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">
<link rel="stylesheet" href="skins/<% =Session["Skin"] %>/styles.css" type="text/css">
</head>

<title>Popup Test</title>
<script language="javascript" type="text/javascript">
function GetRowValue(){ var val=window.opener.document.getElementById("txtPopup").value;}
</script></head><body onload="GetRowValue()"> <form id="form1" runat="server">
<div>
<asp:Label ID="lbl2" runat="server">
</asp:Label>
</div>
</form>

0

ismailc,

Use bb code tag when post a source code. See # icon at top of post editor.

Correction to @pravinkumar's post,

in the second page assign the value in the session variable to textbox2 in Page_Load
textbox2.value=session["tb1"];

Check the availability of an object,

if(Session["tb1"]!=null) {
     TextBox2.Text=Session["tb1"].ToString();
  }

Edited by __avd: n/a

0

Apologies, I'm lost.

The code provided does not work in my page syntax.
I'm editing the aspx page in notepad.

Please assist, Regards

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.