Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

multiple page user forms

Status
Not open for further replies.

zoidberg84

Programmer
Joined
Feb 21, 2006
Messages
9
Location
GB
hello, i am creating a website that requires users to enter their details and then i insert them into a database, i use "templatefields" to bind text to a field from the database and this works perfectly. However i have a textbox that takes the user's postcode and sends it to the database...what i really want to do is also send the postcode in a querystring to the next page! it works like so:

Page 1 = subscribe.aspx
Code:
<asp:TemplateField HeaderText="Post Code">
<InsertItemTemplate>
<asp:TextBox ID="postCodeTextBox" runat="server" Text='<%# Bind("Address_PostCode") %>'></asp:TextBox>
</InsertItemTemplate>
</asp:TemplateField>
Page 2 = payment.aspx

here i link all the data to another table in the same database but i want the page to load with post code textbox on this page already containing the users post code - having been entered and sent from the last page!?!?!

I am lost, i have looked at session state but it didnt help! any ideas??

 
zoidberg84,

You can send the postal code through the QueryString like you said (ie;payment.aspx?code=99181) then in the Page_Load event of Payment.aspx do:
Code:
[b]TextBox1[/b].Text=Request.QueryString("code")

(Replace TextBox1 with the name of your textbox) and this will load the passed postal code into the textbox.

Senior Qik III,.Net,SQL Programmer

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
** Do NOT feed Code Gremlins after midnight **
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
Can i still post the address to the queryString using a template field?? I thought you had to do that with the "postCodeTextBox.Text" command but obviously i have used that to "bind" the text to the database!

how do i post the text to the queryString??

sorry if i am being an idiot, but i seem to have spent hours on this and keep missing the answer!!

thank you
 
I am confused, you want to pass the postal code from the textbox to the querystring to use on the next page?

You can set the querystring by using that value, depending on how you are naviagating to the next page, OR
An easier method, use a session variable.

Jim
 
yeh i want to pass the postcode value from one page to another, but it is already being sent to a database...

basically my question is this:-

Can you pass a text box value used in a templatefield field to the queryString to then retreieve on another page??

If so, how do you do it? could someone show me with the baove example of code?!

if not, how else do i go about it?
 
I am assuming you want to do this once the update is complete?
Code:
Private Sub DataGrid1_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.UpdateCommand
''.. do all your updating code here.. then redirect
   Dim tb As New TextBox
   tb = CType(e.Item.FindControl("postCodeTextBox"), TextBox)
   Response.Redirect("Page2.aspx?PostCode=" + tb.Text)
End Sub
Jim
 
oh cool, the problem here is that i used a DetailsView instead of a DataGrid and 'Item' is not a member of 'System.Web.UI.WebControls.DetailsViewInsertedEventArgs'

so what do i use instead?

sorry to be a pain, thank you
 
Type e. and see what options intellesense gives you. I don't have VS2005 here to check right now.
 
yeh i found its e.values.item, thanks for the help!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top