Hello All, :rolleyes:

I found this code from and artical posted back in may and i had a newbie question that i would like to add to it.

1. Is this the proper all around method to pass values?
2. How would i capture these values? Could i do it in a textbox, label, ect..
3. Coluld i capture it in hidden fields some way.

* Anything someone would like to inform my on about the ((((HttpContext))) and what it is all about ((From a developers standpoint))) i would love to hear about it!

Thank you ahead of time.

Erik.....

Dallas..


==============WebForm1=========

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub


Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click
Dim context As HttpContext = HttpContext.Current
context.Items.Add("strFirstName", TextBox1.Text)
Server.Transfer("Webform2.aspx", True)
End Sub


End Class

=========================Webform2=====================

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim context As HttpContext = HttpContext.Current
Response.Write("Your First Name is: " & context.Items("strFirstName"))
End Sub

End Class

Here is a good article reviewing the use of HttpContext

LINK

another

LINK 2

and an excellent article from those guys from Rolla!

Rolla

Hope this helps

:cool:

Hello All, :rolleyes:

I found this code from and artical posted back in may and i had a newbie question that i would like to add to it.

1. Is this the proper all around method to pass values?
2. How would i capture these values? Could i do it in a textbox, label, ect..
3. Coluld i capture it in hidden fields some way.

* Anything someone would like to inform my on about the ((((HttpContext))) and what it is all about ((From a developers standpoint))) i would love to hear about it!

Thank you ahead of time.

Erik.....

Dallas..


==============WebForm1=========

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub


Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click
Dim context As HttpContext = HttpContext.Current
context.Items.Add("strFirstName", TextBox1.Text)
Server.Transfer("Webform2.aspx", True)
End Sub


End Class

=========================Webform2=====================

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim context As HttpContext = HttpContext.Current
Response.Write("Your First Name is: " & context.Items("strFirstName"))
End Sub

End Class

Dani,

I have a small request for you. The second article was really informative and very explanatory. The only draw that I am having is that I need to see this in a real world code scenario.

In the code below the author is describing how to access a hash table using the httpcontext.items. My question to you is how are the controls tied to this call to the hash table?

I understand everything other than how the code merges into the regular code.

My example of regular code-à dim cnn as new sqlconnection(“)

Dim da as new sqldataadapter(“) ‘ all of this code is what I am use to.

Dim ds as new dataset ‘Now how is the other used to tie the control?

Da.fill (ds,Hashtest) ‘I understand the concept of checking the httpcontext

MyDatalist.Datasource = ds to see if any data is there to be used so that a call

MyDatalist.databind to the database would not be necessary. So how do this

Contol (MyDatalist) tie into the hashtable?

Page the example is at--> http://aspnet.4guysfromrolla.com/articles/060904-1.aspx

Thank you for your help!!! GREAT RESOURCES!

This article has been dead for over six months. Start a new discussion instead.