Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
1.00/5 (11 votes)
See more:
i am new with vb.net?

Tell me how to get value from previous page?
Posted
Comments
Prerak Patel 1-Jul-11 5:08am    
ASP.Net-VB.Net??

You could barshel in the bistfelber and gendle precariously over the quantribolm (sorry about the spelling on this word - I'm a traditionalist).
 
Share this answer
 
Comments
S Houghtelin 1-Jul-11 8:38am    
Excellent! I shall implement this immediately. As soon as I can link the bistfelber to the frengous framwork.
You can also do it this way:

Resolving PostBackUrl and button_Click events[^]

EDIT =======================

Why was this voted a 1? It's the only correct answer so far (other than my other one, of course).
 
Share this answer
 
v2
Comments
Nagy Vilmos 1-Jul-11 9:36am    
My 5 gives it a 420 gpa.
Everyone is assuming a web app, but you didn't say that. Is it a web app ? If so, you should say so. The easiest way to get values from a previous page, is if you store them in the session, put them on the URL, as prem said, or do a cross page postback, then you can access the previous page. However, in most cases, a desire to access things from the last page, is a sign your design is broken. The other thing you can do, is make your two pages controls, host them on the same actual page, then you can pass values back and forth at will. That is the best way to, for example, create a wizard in ASP.NET.

If you're new to VB.NET, you should learn it first, THEN learn ASP.NET.
 
Share this answer
 
You can use Server.Transfet method to send value from previous page.

May this help You.
Happy Codding.
 
Share this answer
 
Comments
Christian Graus 1-Jul-11 5:19am    
How does that work ? You can do a server transfer to MOVE to another page, how does that pass values ?
Pete O'Hanlon 1-Jul-11 7:06am    
This user is replying to a sock puppet account who he is using to accept any crap that he chooses to put in.
prem shanker verma 1-Jul-11 8:35am    
Dear Christian Graus,

First, read the question carefully. It is written that how to get value from previous page, not to send value from first page to another page.
So, Server.Transfer works better here

Here is the code
On first page

Protected Sub btnFirstPage_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Server.Transfer("testingForReverse.aspx")
End Sub

And on Second Page Load event

Dim objPage As Page = Page.PreviousPage
Dim txtName As TextBox = CType(objPage.FindControl("txtName"), TextBox)
txtSecondName.Text = txtName.Text

Here i m sending textbox value from first page to second page.

If i am wrong, then you know learning in this field never ends.
You are welcome.
Sorry for my language.
Pete O'Hanlon 1-Jul-11 7:07am    
No you can't. Server.Transfer moves you somewhere - however, I see that you've used your sock puppet account to accept this answer, even though it is completely wrong. It couldn't be more incorrect if you had just typed bibble.
Sue-de-Nime 1-Jul-11 11:23am    
Shame on you: replying to your own question to gain reputation points!
Or use Query string to send value from previous page to next page.
 
Share this answer
 
Comments
sparkingprem 1-Jul-11 5:11am    
Thank you?
Christian Graus 1-Jul-11 5:19am    
Yes, this actually works.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900