Web Wiz - Solar Powered Eco Web Hosting

  New Posts New Posts RSS Feed - Passing data between asp.et pages
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Passing data between asp.et pages

 Post Reply Post Reply
Author
PrivateEye View Drop Down
Groupie
Groupie
Avatar

Joined: 21 March 2003
Location: United Kingdom
Status: Offline
Points: 168
Post Options Post Options   Thanks (0) Thanks(0)   Quote PrivateEye Quote  Post ReplyReply Direct Link To This Post Topic: Passing data between asp.et pages
    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.
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
PrivateEye View Drop Down
Groupie
Groupie
Avatar

Joined: 21 March 2003
Location: United Kingdom
Status: Offline
Points: 168
Post Options Post Options   Thanks (0) Thanks(0)   Quote PrivateEye Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
mpdotnet View Drop Down
Newbie
Newbie


Joined: 31 July 2009
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote mpdotnet Quote  Post ReplyReply Direct Link To This Post 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"/>

 

Back to Top
georgebaker View Drop Down
Newbie
Newbie
Avatar

Joined: 11 March 2010
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote georgebaker Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
longcall911 View Drop Down
Newbie
Newbie


Joined: 02 October 2004
Location: United States
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote longcall911 Quote  Post ReplyReply Direct Link To This Post 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"] ;
%>
Back to Top
vivanmandy View Drop Down
Newbie
Newbie


Joined: 26 December 2013
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote vivanmandy Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.07
Copyright ©2001-2024 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Policy

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2024 Web Wiz Ltd. All rights reserved.