473,395 Members | 1,742 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

button_Click event and Request.Redirect

Hi,

In my .Net 2.0 C# web form Form1, say I have a button btnToForm2.
Is the Request.Redirect("Form2") the right way to go to the Form2 in the
btnToForm2_Click event?
Actually, I also want to pass a parameter from the Form1 to Form2, do I need
to declare a global variable for storing?
Thanks for help.
Jason
Jun 7 '07 #1
2 4728
Jason,

You have a couple options:

You can call set the variables in the session state, and call
Response.Redirect to send the browser to the new page.

You can call Server.Transfer and the context will apply to the new page.

You can call Response.Redirect and pass the parameters in the querystring.

Hope this helps,
Steve

"Jason Huang" <Ja************@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Hi,

In my .Net 2.0 C# web form Form1, say I have a button btnToForm2.
Is the Request.Redirect("Form2") the right way to go to the Form2 in the
btnToForm2_Click event?
Actually, I also want to pass a parameter from the Form1 to Form2, do I
need to declare a global variable for storing?
Thanks for help.
Jason


Jun 7 '07 #2
PlatinumBay wrote:
Jason,

You have a couple options:

You can call set the variables in the session state, and call
Response.Redirect to send the browser to the new page.

You can call Server.Transfer and the context will apply to the new page.

You can call Response.Redirect and pass the parameters in the querystring.

Hope this helps,
Steve

"Jason Huang" <Ja************@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>Hi,

In my .Net 2.0 C# web form Form1, say I have a button btnToForm2.
Is the Request.Redirect("Form2") the right way to go to the Form2 in the
btnToForm2_Click event?
Actually, I also want to pass a parameter from the Form1 to Form2, do I
need to declare a global variable for storing?
Thanks for help.
Jason


Hello.

I agree with Steve.

Just keep in mind these considerations when deciding which of the three
approaches to use.
1. About storing variables in the session - it is good approach if using
just variables. If you plan to store some objects like tables and so on,
you should not forget about the overhead this is going to cause (thus
probably delaying your application execution time).
2. About the Server.Transfer method. Since the way this method works you
won't be able to click the "back" button and return to the first form.
That's why I don't like this approach.
3. Passing your variables in the query string is fine if they are
meaningless. I mean that choosing to pass information in this way
everyone would be able to see it, since everyone is able to see the
connection string.

Greetings!

Dimitar V.
Jun 12 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Tim Thomas | last post by:
Hi, I am very new to .NET and am in the process of building my first web application. I will briefly describe what i am trying to achieve: I have a system where suppliers register their...
1
by: Alessandro Rossi | last post by:
Hi, I am having this problem: I have developed a composite component which has 2 components: a textbox and a button. I need to add an eventhandler to a button click. I have added the eventhandler,...
6
by: MooreSmnith | last post by:
When I navigate to the next page using Response.Rediect("MyNextPage.aspx") current page Page_Load event is called. What I may wrongly understood is that post back will happen whenever there is any...
2
by: Frank Schumacher | last post by:
Hi Folks, I have a problem with the order of events fired by ASP.NET. I found many articles which explaining the lifecycle of a site, but I found none which took the event from a Control on the...
7
by: Markus McGee | last post by:
Hi all, I have a quick question...I believe. On my web page, call it page A, I have a drop downlist with runat server enabled. When the drop downlist change event occurs it repopulates a...
1
by: Ravindra | last post by:
Hi, Im trying to use Response.Redirect in Session_End event in Global.asax page, which is not working. Why this is not working? And if this not works here, how do I hanlde this? Any possible and...
3
by: I am Sam | last post by:
Please help. I'm dying here and pulling out the last few remaining elements of my hair over this. I have built a form that will identify and authenticate users. I keep getting the following...
13
by: Matt | last post by:
I am trying to call a recursive subroutine within a Button_Click event. How can I do this? I tried to create a seperate Function() but it will not allow me to use any variables that I created in...
0
by: John | last post by:
I am loading my controls dynamically into my asp.net page. When I click on a button on one of those user controls then page reloads and I need to reload the page based on what has happened in the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.