Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Transfering info from one web form to another (c# ASP.Net)

  • 20-04-2009 3:05pm
    #1
    Closed Accounts Posts: 16,095 ✭✭✭✭


    Hey all,

    i'm doing a project in college at the moment. On one web form I have the user entering a number. I need to use this number in a different form and I can't work out how to do this, even after hours of googling :rolleyes::o

    Can anybody out there help me?!

    Thanks


Comments

  • Registered Users, Registered Users 2 Posts: 26,584 ✭✭✭✭Creamy Goodness


    you could achieve it by using sessions,

    something like this may help http://msdn.microsoft.com/en-us/library/ms178581.aspx

    store the number entered by the user in a session, then when you need to use it again, retrieve the value from the session and input it where ever ya need it.


  • Registered Users, Registered Users 2 Posts: 527 ✭✭✭Sean^DCT4


    If you are passing just an integer to another web form then I would suggest using the QueryString. Request.QueryString["whatever"].

    Example:

    Button Click Event on page calls:
    Response.Redirect("APageWithQueryString.aspx?MyPassedVal=123");
    

    On your APageWithQueryString.aspx page you can retrieve the value using
    int myPassedInValue = Convert.ToInt32(Request.Querystring["MyPassedVal"]);
    

    Note: MyPassedVal is the querystring field. 123 can be any string you want


  • Closed Accounts Posts: 522 ✭✭✭comer_97


    you could also use a HTTPContext too. They have made it very unintuitive.


  • Registered Users, Registered Users 2 Posts: 2,793 ✭✭✭John_Mc


    comer_97 wrote: »
    you could also use a HTTPContext too. They have made it very unintuitive.

    What do you mean?


  • Closed Accounts Posts: 522 ✭✭✭comer_97


    John_Mc wrote: »
    What do you mean?

    Do you mean how it is unintuitive or how to use a httpcontext?

    HTTPContext stuff

    As for it being unintuitive, why doesn't .net embrace the humble html form? It's worked well for years and works well, why change it?

    Once .net gets to the presentation layer it is a shambles. It's use of css is terrible and trying to do anything clientside is really complex, unnecessarily so.

    Hopefully XAML will change this but I've yet to use it professionally.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 11,989 ✭✭✭✭Giblet


    You can use CSSFriendly adapters, and the new MVC framework is pretty decent, doesn't rely on postbacks!

    Still, there were some mistakes made initially, but they are trying to rectify them.


  • Registered Users, Registered Users 2 Posts: 885 ✭✭✭clearz


    comer_97 wrote: »
    why doesn't .net embrace the humble html form? It's worked well for years and works well, why change it?
    You can use HTML foms perfectly easily by just using the HTML controls instead of the Web Controls
    comer_97 wrote: »
    Once .net gets to the presentation layer it is a shambles. It's use of css is terrible and trying to do anything
    clientside is really complex, unnecessarily so.

    You really have 3 different choices with .NET
    HTML Controls
    Web Forms
    MVC
    Each have their uses and misuses. But there is something for everyone and every type of site/application here
    comer_97 wrote: »
    Hopefully XAML will change this but I've yet to use it professionally.
    XAML's only use on the web is with Silverlight and adds nothing new to plain old HTML pages.


Advertisement