Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: ACCESSING VALUES ACROSS PAGES.


Message #1 by "Rohit Arora" <rohit_arora@i...> on Thu, 26 Dec 2002 17:27:46 +0530
Hie group I have written a small code in which I am using 2 forms (i am not
sure if we can) -- but lemme tell y i am using I jes want to access the
value of checkbox(present in first form) on someother page of my site.But i
am posting this page to itself only. Thatz y i am putting value of this
checkbox in hidden field in form2 and posting that form to the page where i
want the values.

There request.form.count = 0
also request.querystring.count = 0

I dont seem to get a solution.

I hv attached my code alongwith.Hope to get help sooooooooooooooon.


Thanx and Regards
rohit


-------------------------
<%@ Page language="c#" Codebehind="CustomizedReports.aspx.cs"
AutoEventWireup="false" Inherits="projInC.CustomizedReports"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
  <HEAD>
		<title>CustomizedReports</title>
		<meta content="Microsoft Visual Studio 7.0" name="GENERATOR">
		<meta content="C#" name="CODE_LANGUAGE">
		<meta content="JavaScript" name="vs_defaultClientScript">
		<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
		<script language="Javascript">
			function showVal()
			{
				alert(submitForm.updateDB.value);
			}
			function confirmDatabaseUpdate()
			{
				if(document.CustomizedReports.updateIVUTable.checked == true)
				{
					var bConfirmed = false;

					bConfirmed = confirm("Update Database.\nUpdating Database may take a
long time.");
					if(bConfirmed)
					{
						submitForm.updateDB.value = true;
						window.open(document.CustomizedReports.hrefPath.value, "_self");
					}
					else
						document.CustomizedReports.updateIVUTable.checked = false;
				}
				else
				{
					document.CustomizedReports.action = "ivu.aspx";
					window.open(document.CustomizedReports.hrefPath.value, "_self");
				}
			}
		</script>
</HEAD>
	<body leftMargin="5" MS_POSITIONING="GridLayout">
		<FORM id="CustomizedReports" method="post" runat="server">
			<p><a style="FONT-SIZE: x-small; LEFT: 20px"
href="<%=Request.ApplicationPath.ToLower()%>/home/homepage.asp">Home
Page</a>
			</p>
			<p><a runat=server id=ReportBtn style="FONT-SIZE: x-small; LEFT: 20px"
href="<%=Request.ApplicationPath.ToLower()%>/Customized/Analysis.aspx">Show
Crystal Reports</a>
			</p>
			<p><a id=ResourceCostBtn runat=server
style="FONT-SIZE: x-small; LEFT: 20px"
href="<%=Request.ApplicationPath.ToLower()%>/Customized/ResourceCost.aspx">E
dit Resource Cost</a>
			</p>
			<p></p>
			<div id="updateTable" runat="server">
			<A id="IVUBtn" style="FONT-SIZE: x-small; LEFT: 20px"
href="javascript:confirmDatabaseUpdate()">Edit Budgeted IVUs and Earned
IVUs</A> &nbsp;
					 <input id="hrefPath" type=hidden
value="<%=Request.ApplicationPath.ToLower()%>/ivu.aspx">
					(<input id="updateIVUTable" runat=server type="checkbox"
name="updateIVUTable">
					<font style="FONT-SIZE: x-small">Update Database</font>)
			</div>
		</FORM>
<form action="ivu.aspx" method="post">
		<input id="updateDB" name="updateDB" type="hidden"
value='<%=updateIVUTable.Text %>' >
</form>
	</body>
</HTML>

Message #2 by "Mike Amundsen" <mike@a...> on Fri, 27 Dec 2002 20:51:42 -0500
Not sure if this is what you are looking for, but a common solution in
ASP.NET is to use Response.Redirect after a postback event to moe on to
a second page.

For example, if you have an ASP.NET page with a postback form with
TextBox1 on it, you can do this (in VB.NET in this case):

*********************************************************
<%@ Page Language="VB" EnableViewState="false"%>
<script runat="server">
    Sub Button1_Click(sender As Object, e As EventArgs)
        ' alter value and pass to next page
        Response.Redirect( _
            String.Format( _
                "page2.aspx?TextBox1={0}", _
                TextBox1.Text.ToUpper() _
             ) _
        )
    End Sub
</script>

In the example, above the querystring is stuffed before the redirect.
You can also use session variables or cookies before the redirect, too.

Finally, ou can drop the server forms and use traditional HTML forms to
post to other pages.

Hope this helps.

BTW - I posted a more complete example of the above at my web site here:
http://amundsen.com/articles.aspx?CatID=1250&PostID=4270

 
MCA
Mike Amundsen
mca@E...
xxx.xxx.xxxx
xxx.xxx.xxxx  (FAX)
Host your .NET apps @ EraServer.NET
 

-----Original Message-----
From: Rohit Arora [mailto:rohit_arora@i...] 
Sent: Thursday, December 26, 2002 6:58 AM
To: ASP.NET
Subject: [aspx] ACCESSING VALUES ACROSS PAGES.

Hie group I have written a small code in which I am using 2 forms (i am
not
sure if we can) -- but lemme tell y i am using I jes want to access the
value of checkbox(present in first form) on someother page of my
site.But i
am posting this page to itself only. Thatz y i am putting value of this
checkbox in hidden field in form2 and posting that form to the page
where i
want the values.

There request.form.count = 0
also request.querystring.count = 0

I dont seem to get a solution.

I hv attached my code alongwith.Hope to get help sooooooooooooooon.


Thanx and Regards
rohit


-------------------------
<%@ Page language="c#" Codebehind="CustomizedReports.aspx.cs"
AutoEventWireup="false" Inherits="projInC.CustomizedReports"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
  <HEAD>
		<title>CustomizedReports</title>
		<meta content="Microsoft Visual Studio 7.0"
name="GENERATOR">
		<meta content="C#" name="CODE_LANGUAGE">
		<meta content="JavaScript"
name="vs_defaultClientScript">
		<meta
content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
		<script language="Javascript">
			function showVal()
			{
				alert(submitForm.updateDB.value);
			}
			function confirmDatabaseUpdate()
			{
	
if(document.CustomizedReports.updateIVUTable.checked == true)
				{
					var bConfirmed = false;

					bConfirmed = confirm("Update
Database.\nUpdating Database may take a
long time.");
					if(bConfirmed)
					{
	
submitForm.updateDB.value = true;
	
window.open(document.CustomizedReports.hrefPath.value, "_self");
					}
					else
	
document.CustomizedReports.updateIVUTable.checked = false;
				}
				else
				{
	
document.CustomizedReports.action = "ivu.aspx";
	
window.open(document.CustomizedReports.hrefPath.value, "_self");
				}
			}
		</script>
</HEAD>
	<body leftMargin="5" MS_POSITIONING="GridLayout">
		<FORM id="CustomizedReports" method="post"
runat="server">
			<p><a style="FONT-SIZE: x-small; LEFT: 20px"
href="<%=Request.ApplicationPath.ToLower()%>/home/homepage.asp">Home
Page</a>
			</p>
			<p><a runat=server id=ReportBtn
style="FONT-SIZE: x-small; LEFT: 20px"
href="<%=Request.ApplicationPath.ToLower()%>/Customized/Analysis.aspx">S
how
Crystal Reports</a>
			</p>
			<p><a id=ResourceCostBtn runat=server
style="FONT-SIZE: x-small; LEFT: 20px"
href="<%=Request.ApplicationPath.ToLower()%>/Customized/ResourceCost.asp
x">E
dit Resource Cost</a>
			</p>
			<p></p>
			<div id="updateTable" runat="server">
			<A id="IVUBtn" style="FONT-SIZE: x-small; LEFT:
20px"
href="javascript:confirmDatabaseUpdate()">Edit Budgeted IVUs and Earned
IVUs</A> &nbsp;
					 <input id="hrefPath"
type=hidden
value="<%=Request.ApplicationPath.ToLower()%>/ivu.aspx">
					(<input id="updateIVUTable"
runat=server type="checkbox"
name="updateIVUTable">
					<font style="FONT-SIZE:
x-small">Update Database</font>)
			</div>
		</FORM>
<form action="ivu.aspx" method="post">
		<input id="updateDB" name="updateDB" type="hidden"
value='<%=updateIVUTable.Text %>' >
</form>
	</body>
</HTML>



Message #3 by "Rohit Arora" <rohit_arora@i...> on Mon, 30 Dec 2002 09:16:15 +0530
Thanx mike it worked. I also found there are some other ways also like by
using Server.Redirect and session variables.

-----Original Message-----
From: Mike Amundsen [mailto:mike@a...]
Sent: Saturday, December 28, 2002 7:22 AM
To: ASP.NET
Subject: [aspx] RE: ACCESSING VALUES ACROSS PAGES.


Not sure if this is what you are looking for, but a common solution in
ASP.NET is to use Response.Redirect after a postback event to moe on to
a second page.

For example, if you have an ASP.NET page with a postback form with
TextBox1 on it, you can do this (in VB.NET in this case):

*********************************************************
<%@ Page Language="VB" EnableViewState="false"%>
<script runat="server">
    Sub Button1_Click(sender As Object, e As EventArgs)
        ' alter value and pass to next page
        Response.Redirect( _
            String.Format( _
                "page2.aspx?TextBox1={0}", _
                TextBox1.Text.ToUpper() _
             ) _
        )
    End Sub
</script>

In the example, above the querystring is stuffed before the redirect.
You can also use session variables or cookies before the redirect, too.

Finally, ou can drop the server forms and use traditional HTML forms to
post to other pages.

Hope this helps.

BTW - I posted a more complete example of the above at my web site here:
http://amundsen.com/articles.aspx?CatID=1250&PostID=4270


MCA
Mike Amundsen
mca@E...
xxx.xxx.xxxx
xxx.xxx.xxxx  (FAX)
Host your .NET apps @ EraServer.NET


-----Original Message-----
From: Rohit Arora [mailto:rohit_arora@i...]
Sent: Thursday, December 26, 2002 6:58 AM
To: ASP.NET
Subject: [aspx] ACCESSING VALUES ACROSS PAGES.

Hie group I have written a small code in which I am using 2 forms (i am
not
sure if we can) -- but lemme tell y i am using I jes want to access the
value of checkbox(present in first form) on someother page of my
site.But i
am posting this page to itself only. Thatz y i am putting value of this
checkbox in hidden field in form2 and posting that form to the page
where i
want the values.

There request.form.count = 0
also request.querystring.count = 0

I dont seem to get a solution.

I hv attached my code alongwith.Hope to get help sooooooooooooooon.


Thanx and Regards
rohit


-------------------------
<%@ Page language="c#" Codebehind="CustomizedReports.aspx.cs"
AutoEventWireup="false" Inherits="projInC.CustomizedReports"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
  <HEAD>
		<title>CustomizedReports</title>
		<meta content="Microsoft Visual Studio 7.0"
name="GENERATOR">
		<meta content="C#" name="CODE_LANGUAGE">
		<meta content="JavaScript"
name="vs_defaultClientScript">
		<meta
content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
		<script language="Javascript">
			function showVal()
			{
				alert(submitForm.updateDB.value);
			}
			function confirmDatabaseUpdate()
			{

if(document.CustomizedReports.updateIVUTable.checked == true)
				{
					var bConfirmed = false;

					bConfirmed = confirm("Update
Database.\nUpdating Database may take a
long time.");
					if(bConfirmed)
					{

submitForm.updateDB.value = true;

window.open(document.CustomizedReports.hrefPath.value, "_self");
					}
					else

document.CustomizedReports.updateIVUTable.checked = false;
				}
				else
				{

document.CustomizedReports.action = "ivu.aspx";

window.open(document.CustomizedReports.hrefPath.value, "_self");
				}
			}
		</script>
</HEAD>
	<body leftMargin="5" MS_POSITIONING="GridLayout">
		<FORM id="CustomizedReports" method="post"
runat="server">
			<p><a style="FONT-SIZE: x-small; LEFT: 20px"
href="<%=Request.ApplicationPath.ToLower()%>/home/homepage.asp">Home
Page</a>
			</p>
			<p><a runat=server id=ReportBtn
style="FONT-SIZE: x-small; LEFT: 20px"
href="<%=Request.ApplicationPath.ToLower()%>/Customized/Analysis.aspx">S
how
Crystal Reports</a>
			</p>
			<p><a id=ResourceCostBtn runat=server
style="FONT-SIZE: x-small; LEFT: 20px"
href="<%=Request.ApplicationPath.ToLower()%>/Customized/ResourceCost.asp
x">E
dit Resource Cost</a>
			</p>
			<p></p>
			<div id="updateTable" runat="server">
			<A id="IVUBtn" style="FONT-SIZE: x-small; LEFT:
20px"
href="javascript:confirmDatabaseUpdate()">Edit Budgeted IVUs and Earned
IVUs</A> &nbsp;
					 <input id="hrefPath"
type=hidden
value="<%=Request.ApplicationPath.ToLower()%>/ivu.aspx">
					(<input id="updateIVUTable"
runat=server type="checkbox"
name="updateIVUTable">
					<font style="FONT-SIZE:
x-small">Update Database</font>)
			</div>
		</FORM>
<form action="ivu.aspx" method="post">
		<input id="updateDB" name="updateDB" type="hidden"
value='<%=updateIVUTable.Text %>' >
</form>
	</body>
</HTML>






  Return to Index