borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Asp.net)Next Topic (Send Email Problem) New Topic New Poll Post Reply
AndreaVB Forum : ASP.Net : Getting value form one form to another
Poster Message
Chris_871
Level: Master


Registered: 30-11-2002
Posts: 106

icon Getting value form one form to another

Hi Friends
I am doing Asp.Net web project.
In one web form i am getting user information. After that i am redirecting into 2nd form. While redirecting i need to send the first form user information to the 2nd form. How to send it ? or from 2nd form i want to get the first form  details. how to get it ?

BY
Chris

04-02-2004 at 05:29 AM
View Profile Send Email to User Show All Posts | Quote Reply
Aleks
Level: Scholar


Registered: 10-11-2003
Posts: 32
icon Re: Getting value form one form to another

via strxxx = request.from("xxx") where xxx are the name of form control.

____________________________
Aleks

06-02-2004 at 03:40 AM
View Profile Send Email to User Show All Posts ICQ | Quote Reply
Aleks
Level: Scholar


Registered: 10-11-2003
Posts: 32
icon Re: Getting value form one form to another

via strxxx = request.from("xxx") where xxx are the name of form control. I have used as is in ASP.

____________________________
Aleks

06-02-2004 at 03:41 AM
View Profile Send Email to User Show All Posts ICQ | Quote Reply
Aleks
Level: Scholar


Registered: 10-11-2003
Posts: 32
icon Re: Getting value form one form to another

Sorry, request.from("xxx") is mistaked, is request.Form("xxx")

____________________________
Aleks

06-02-2004 at 03:42 AM
View Profile Send Email to User Show All Posts ICQ | Quote Reply
Chris_871
Level: Master


Registered: 30-11-2002
Posts: 106
icon Re: Getting value form one form to another

Hi Aleks

Thank you for your response for my request.

I have searched in MSDN library and got some ideas. Which I want to share here.

Use a query string, which appends information onto the URL and passes it to the next page. This has the disadvantage of making the information visible.

Use Session state to store information that is then accessible globally to all pages in the user's current session. However, this takes server memory and the information is stored until the session expires.

Instead of using thOse methods we can create a read only property of the particular value. Then we can access the property from target webform.

Write the following code into the source page,
//I am using C##


public string u_name
{
   get
   {
      return Txtusername.Text;
   }
}


You must create a global instance variable for the source webform (webform1)
//This code must place on the webform1

public WebForm1 sourcepage;


In a button click handler write the following code to redirect into second web form

Server.Transform("webform2.aspx")

Now you can get the source page through Context.Handler object.

//page_load event of webform2

private void Page_Load(object sender, System.EventArgs e)
{
   if (!IsPostBack)
   {
      WebForm1 sourcepage = (WebForm1) Context.Handler;

      lblwelcome.Text  = "Welcome " + sourcepage.u_name;

   }
}


I am using this method. It works fine.

By

Chris

12-02-2004 at 08:24 AM
View Profile Send Email to User Show All Posts | Quote Reply
Aleks
Level: Scholar


Registered: 10-11-2003
Posts: 32
icon Re: Getting value form one form to another

I said request.Form, where the information passed between forms are hidden to user, but not to pages. Or if you want use Session variables, itīs the same thing in some ways, the Session variables are accessed via ASP code but not accessed by the user.

Request.Querystring appends variables to the URL, and if you want to send confidential data, do NOT use this way. Or if you use this,  encrypt data.




____________________________
Aleks

17-02-2004 at 05:24 AM
View Profile Send Email to User Show All Posts ICQ | Quote Reply
AndreaVB Forum : ASP.Net : Getting value form one form to another
Previous Topic (Asp.net)Next Topic (Send Email Problem) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder