Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 6th, 2009, 04:56 AM
bex bex is offline
Friend of Wrox
 
Join Date: Aug 2008
Posts: 154
Thanks: 7
Thanked 1 Time in 1 Post
Default How to find Values From Previous Page using Server.Transfer

Hi there
i have this code:
Code:
ProtectedSub CustomValidator1_ServerValidate(ByVal source AsObject, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles CustomValidator1.ServerValidate
args.IsValid = True
ForEach drv As DataRowView In SqlDataSource1.Select(DataSourceSelectArguments.Empty)
If drv("Name").ToString() = args.Value Then
args.IsValid = False
ExitFor
EndIf
Next
If args.IsValid Then
Me.Response.Redirect("send.aspx")
'Else
' Me.LblErrorMessage.Text = "Name Exsists"
EndIf
EndSub
ProtectedSub btnNext_Click1(ByVal sender AsObject, ByVal e As System.EventArgs) Handles btnNext.Click
'Response.Redirect("~/Send.aspx")
EndSub
every thing works in this page but when i navigate to send.aspx i cant find the controls from this page.
if i use postbackurl i see the controls but the validation does not occur.
i use this to fined the controls in send.aspx:

Code:
IfNot Page.PreviousPage IsNothingThen
Dim txtName As TextBox
Dim txtEmail As TextBox
Dim WorkName As TextBox
Dim Leadsorce As TextBox
Dim ListBox1 As ListBox
 
 
 
txtName = CType(PreviousPage.FindControl("txtName"), TextBox)
txtEmail = CType(PreviousPage.FindControl("txtEmail"), TextBox)
WorkName = CType(PreviousPage.FindControl("WorkName"), TextBox)
Leadsorce = CType(PreviousPage.FindControl("Leadsorce"), TextBox)
ListBox1 = CType(PreviousPage.FindControl("ListBox1"), ListBox)
i need to be able to click the next button the validation occurs and if the name does not exsist go to next .

at the moment everything works if i don't go to send.aspx.

thanks
__________________
bx
 
Old March 6th, 2009, 07:04 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Hello.

Long shot, but you are asking for page.previouspage in the if, but after you are just using previouspage. don't have a clue is that can cause a problem, but better check it out.
__________________
HTH

Gonzalo


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========
 
Old March 6th, 2009, 09:41 AM
bex bex is offline
Friend of Wrox
 
Join Date: Aug 2008
Posts: 154
Thanks: 7
Thanked 1 Time in 1 Post
Default

i took a diferent approach used 2 buttons next and search so when user =true btnNext=False.

I have another problem now.

it works from the SlqDatasource1 that is opening 1 table, i need to be able to change the connection to be dinamic, like:

Select Name FROM " & textbox1 " &.

i tryed to hardcode the connection in the page.aspx.vb but it gives me an error Connection is not declared


thanks
__________________
bx
 
Old March 6th, 2009, 09:50 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

You better make a new thread for this, because the datasource define the Query in the page definition, but I don't know if you can change it.
__________________
HTH

Gonzalo


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Pass Values From Previous Page bex ASP.NET 2.0 Professional 3 January 13th, 2009 07:24 AM
transfer values between webforms Sheraz Khan ASP.NET 2.0 Basics 3 July 26th, 2007 06:42 AM
Find previous page gandaliter PHP How-To 2 June 7th, 2007 11:55 AM
Get values of asp controls on previous page GraceOriole ASP.NET 2.0 Professional 0 December 20th, 2006 11:35 PM
Transfer Values from one page to another page saravananedu ASP.NET 1.0 and 1.1 Basics 6 August 17th, 2005 12:03 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.