Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 15th, 2004, 02:27 AM
Authorized User
 
Join Date: Jul 2003
Location: Kolkata, West Bengal, India.
Posts: 51
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to sankar
Default Passing Form Values in ASP.Net

Hi Xperts,
I am trying to pass form values from one form to another.I cannot use Session/Query Strings. So, what is the best way to pass values between forms? I am using ASP.Net Version 1.0, So, pls avoid telling me advance options that DotNet has recently introduced.
Thx in adv.

Sankar Sengupta
Striving for the BEST
__________________
Sankar Sengupta
Striving for the BEST
Reply With Quote
  #2 (permalink)  
Old July 16th, 2004, 12:23 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: Chennai, TamilNadu, India.
Posts: 326
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Santhi Send a message via MSN to Santhi
Default

Use public variable for passing the values between forms..

Reply With Quote
  #3 (permalink)  
Old July 16th, 2004, 08:09 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Quote:
quote:Originally posted by Santhi
 Use public variable for passing the values between forms..
You can't do this. ASP.NET forms are never open at the same time.

If you can't use session or query strings, then your options are pretty severely limited. Can you use Cookies? If not, then I think your only solution is to generate your own form on the page (outside of the default form, which you may not even be permitted to do) and post that form to the other page. But if that's the case then you are pretty well defeating the purpose and capabilities of ASP.NET.

Why do you have this restriction on session and querystring use?

Keep in mind that new features of ASP.NET still won't help you because you are still limited by what HTML can do for you. This means that you are still limited to A)Querystring or B)Cookies (which are used for sessions).
Reply With Quote
  #4 (permalink)  
Old July 17th, 2004, 01:31 AM
Authorized User
 
Join Date: Jul 2003
Location: Kolkata, West Bengal, India.
Posts: 51
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to sankar
Default

I cannot pass this in Query String as I have long data, which might get truncated in Query String. Session is the option that I am currently using. I was wondering like ASP, can I use hidden fields?
May be that shd help me....
Quote:
quote:Originally posted by planoie
 
Quote:
quote:Originally posted by Santhi
Quote:
 Use public variable for passing the values between forms..
You can't do this. ASP.NET forms are never open at the same time.

If you can't use session or query strings, then your options are pretty severely limited. Can you use Cookies? If not, then I think your only solution is to generate your own form on the page (outside of the default form, which you may not even be permitted to do) and post that form to the other page. But if that's the case then you are pretty well defeating the purpose and capabilities of ASP.NET.

Why do you have this restriction on session and querystring use?

Keep in mind that new features of ASP.NET still won't help you because you are still limited by what HTML can do for you. This means that you are still limited to A)Querystring or B)Cookies (which are used for sessions).
Sankar Sengupta
Striving for the BEST
Reply With Quote
  #5 (permalink)  
Old July 19th, 2004, 08:27 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

ASP.NET operates in the request-response paradigm of the web. Your browser/client issues a "request" for a page, the server loads the page and generates the HTML output and sends the result in the "response" to the browser. That's it, one shot, one page at a time. The browser can only request one page at a time, and as a result only one page is every "open" or running at a single moment. So in this respect you can not have one page talk to another page.

The problem with hidden fields is that ASP.NET doesn't allow you to post to a different page. It uses the postback method which posts to the same page. Then you have to redirect to another page. However, there is a way around this. You can use Server.Transfer which retains the posted form data. Then you could use Request.Form to get at the hidden field. But keep in mind that you'll need to access the proper name of the form field. If the field is just a regular field on the page, then you can use the regular name of it and it shouldn't be too much of a problem.
Reply With Quote
  #6 (permalink)  
Old July 21st, 2004, 10:43 AM
Authorized User
 
Join Date: Jul 2004
Location: Derby, , United Kingdom.
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Chap,

I know your limited to whatyou can do and use, but why not create a HTML form using different ASP.NET controls, then use the post this forms contents to your processing aspx page.

What kind of data are you trying to obtain if I can be so cheeky as to ask?

What does my picture not work !
Reply With Quote
  #7 (permalink)  
Old July 21st, 2004, 12:31 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

You may want to look at Server.Transfer method. I think that was introduced in ASP.NET 1.0...

http://www.dotnetjohn.com/articles.aspx?articleid=142

Brian
Reply With Quote
  #8 (permalink)  
Old July 22nd, 2004, 12:18 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: Chennai, TamilNadu, India.
Posts: 326
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Santhi Send a message via MSN to Santhi
Default

Sankar here is the example

Firstpage..
namespace TestSamples
{
    /// <summary>
    /// Summary description for FirstPage.
    /// </summary>
    public class FirstPage : System.Web.UI.Page
    {
    protected System.Web.UI.WebControls.TextBox TextBox1;
    protected System.Web.UI.WebControls.Button Submit;
    protected System.Web.UI.WebControls.TextBox TextBox2;
    public static string strFirstName;
    public static string strLastName;
    private void Page_Load(object sender, System.EventArgs e)
    {
    // Put user code to initialize the page here
        strFirstName = Request["TextBox1"];
        strLastName = Request["TextBox2"];
    }

    private void Submit_Click(object sender, System.EventArgs e)
    {
        strFirstName = Request["TextBox1"];
        strLastName = Request["TextBox2"];
        Response.Redirect("http://localhost/testsamples/secondpage.aspx");
    }
    }
}
SecondPage..
namespace TestSamples
{
    /// <summary>
    /// Summary description for SecondPage.
    /// </summary>
    public class SecondPage : System.Web.UI.Page
    {
           protected System.Web.UI.WebControls.TextBox TextBox1;
       protected System.Web.UI.WebControls.TextBox TextBox2;
       private void Page_Load(object sender, System.EventArgs e)
    {
      // Put user code to initialize the page here
        TextBox1.Text=FirstPage.strFirstName;
         TextBox2.Text=FirstPage.strLastName;
          }

    }

Reply With Quote
  #9 (permalink)  
Old November 4th, 2004, 10:36 AM
Registered User
 
Join Date: May 2004
Location: , , Ireland.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

The server.transfer method is fine. But how do I pass values between 3 different pages ?. I don't want to use sesions OR query string, because the data is sensitive. So what is the best way to do it ?.

Please help, thanks.

Regards,
Karthick


Regards,
Karthick
Reply With Quote
  #10 (permalink)  
Old November 4th, 2004, 12:18 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,111
Thanks: 0
Thanked 3 Times in 3 Posts
Default

If it's sensitive you need to use SSL.

You can send the information to a table in a DB. This is just another method. Sensitivity issues still persist.


Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
passing Multidimensional Array Values back to form stitch Classic ASP Databases 2 June 21st, 2013 01:59 PM
Passing form values from 1 frame to another. edkeyte Javascript How-To 4 February 2nd, 2004 12:33 PM
Passing values to a form mschenk Access VBA 4 November 30th, 2003 11:39 PM
Passing Values from a Form to another Louisa Beginning VB 6 1 September 2nd, 2003 07:56 AM



All times are GMT -4. The time now is 01:18 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.