Print Page | Close Window

Passing data between asp.et pages

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: ASP.NET Discussion
Forum Description: Discussion and chat on ASP.NET related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=27585
Printed Date: 27 March 2026 at 11:02pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Passing data between asp.et pages
Posted By: PrivateEye
Subject: Passing data between asp.et pages
Date Posted: 17 July 2009 at 4:00pm
Hello,
 
I have searched google for my problem but could not find desired answers. I want to know that if I use
 
Filename: source.aspx

<form id="form1" method="post" action="destination.aspx" runat="server">

<asp:TextBox ID="txtusername" runat="server"></asp:TextBox>

<asp:TextBox ID="txtpassword" runat="server" TextMode="Password"></asp:TextBox>

<asp:Button ID="Button1" runat="server" Text="Button" />

</form>

How can I write a code for the button1_click() event so that it can transfer user from source.aspx to destination.aspx page and how can I write code to access values of txtusername and txtpassword controls of source.aspx page. I don't want to use session object.
Thank you.



Replies:
Posted By: Mart
Date Posted: 19 July 2009 at 4:17pm
I wouldn't use an ASP.NET form for that. Just whack out some standard html.

<form method="post" action="destination.aspx">
<input type="text" ID="txtUsername"/>
<input type="password" id="txtPassword"/>
</form>


Then in destination.aspx just use Request.Form["txtUsername"] to get the username field, and the same for the password.


Posted By: PrivateEye
Date Posted: 23 July 2009 at 5:12pm
Thank you for your help, I used Response.Redirect method and passed the variables in QueryString. Thanks

-------------
The Judgement Day


Posted By: mpdotnet
Date Posted: 31 July 2009 at 5:38pm
Hi, I've just joined the forum and I saw this post which I thought I could answer.
 
If you want an ASP.NET solution, you can post to a different page using the PostBackUrl attribute on your Button control.

<asp:Button ID="Button1" runat="server" Text="Button" PostBackUrl="Destination.aspx"/>

 



Posted By: georgebaker
Date Posted: 11 March 2010 at 4:12pm
I'm lucky to see this post because I was facing same kind of problem, but thank you, i resolved my issue with your help.


Posted By: longcall911
Date Posted: 11 May 2010 at 12:25am
If you use mpdotnet's example of the PostBackUrl="Destination.aspx" you can add querystring variables so the full url might be: Destination.aspx?firstName=John&lastName=Doe
 
Then in destination.aspx use 
{c#code}
 
<%
String firstName = Page.Request.QueryString["firstName"] ;
%>


-------------
make your meetings interactive with an http://www.comtec-ars.com" rel="nofollow - Audience Response System


Posted By: vivanmandy
Date Posted: 26 December 2013 at 7:05am
check this for more detail http:/et-inations.com/faq/asp/passing-values.htm - http://net-informations.com/faq/asp/passing-values.htm asp.net passing values.
 
vivan.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net