473,406 Members | 2,843 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,406 software developers and data experts.

Question about querystring

In my restaurant.aspx, I have a 2 dropdownlists (ddlState, ddlCity)
and a button (btnFindRestaurants). The 2 dropdownlist has the first
item as "--Choose--"

After user selected a state and a city and clicked the
btnfindrestaruants button, it should redirect to storelist.aspx page
by using querystrings and list all the restaurants belongs to the
selected State and city.

However, after user selected the state and city, and clicked the
button, the querystring only carries State, I found city is passed
the value "--Choose--" at runtime ( City =
Request.QueryString("City")) but city is picked by user other than
the "--Choose--".

Here is my code, can someone please tell me why I can't get the
selecte value from the City dropdownlist? Thank you.

In restaurant.aspx
------------------------------------
Private Sub btnFindRestaurants_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnFindRestaurants.Click

Response.Redirect("storelist.aspx?City=" + ddlCity.SelectedItem.Text +
"&State=" + ddlState.SelectedItem.Text, True)

End Sub
------------------------------------

In storelist.aspx

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
Dim State As String
Dim City As String
Dim ds As DataSet
Dim dr As SqlDataReader
State = Request.QueryString("State")
City = Request.QueryString("City")
conDWDb.Open()
Dim cmdCountStores As New SqlCommand
Dim dtrCountStores As SqlDataReader
With cmdCountStores
.Connection = conDWDb
.CommandText = "Select Count(*) As CountStores from store_table where
co_code=1 and store_mgr is not null and State=@State and City=@City"

.Parameters.Add("@State", SqlDbType.Char).Value = State
.Parameters.Add("@City", SqlDbType.Char).Value = City
End With
dtrCountStores = cmdCountStores.ExecuteReader
dtrCountStores.Read()
lblnumber.Text = dtrCountStores("CountStores")
dtrCountStores.Close()
conDWDb.Close()
End If
End Sub
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 19 '05 #1
1 1117
My guess would be that you are re-binding the dropdownlist in
restaurant.aspx before the SelectedItem property is accessed in
btnFindRestaurants_Click.

Nov 19 '05 #2

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

Similar topics

13
by: Samantha Smit | last post by:
Hi, I am trying to create a simple asp page that has one command button that updates a database. The URL of the page is like this: http://MyServer.com/Update.asp?UserName=Tom My asp code is...
0
by: Ryan Smith | last post by:
Hi All I have an app and in that app i have a registration program that i wrote that will send the users registration data to the server and then receive a response code back from the server and...
9
by: SASRS | last post by:
Here is my code. I am trying to see if I can put a %@ LANGUAGE="VBSCRIPT" %> <% FieldA = Request.QueryString("A") FieldB = Request.QueryString("B") FieldC = Request.QueryString("C") ...
17
by: Paul | last post by:
HI! I get an error with this code. <SCRIPT language="JavaScript"> If (ifp==""){ ifp="default.htm"} //--></SCRIPT> Basicly I want my iframe to have a default page if the user enters in...
9
by: Doug | last post by:
I need to do the following... FOR myitem IN Request.Querystring 'get the key 'get the value NEXT What do I DIM myitem as? DictionaryEntry doesn't work...or do I have to loop through it by...
7
by: Stan Sainte-Rose | last post by:
Hi, I use this bit of code to generate dynamic tables in the page load section .... Dim ntable as New Table For i = 1993 To 2008 ntable = New Table ntable.ID = "Q" + i.ToString .... ....
7
by: Bruno Alexandre | last post by:
Hi guys, Sorry about the off topic, but I can't find the ASP group just the ASP dot NET If I want to block a user to change a form after submiting, I add a function that will disable the...
7
by: Goober | last post by:
I have a page that receives a session variable from the default.aspx. On Page load, the code in Page load gets executed twice. So far, no problem. It sets the session variable each time,...
10
by: glenn | last post by:
I am use to programming in php and the way session and post vars are past from fields on one page through to the post page automatically where I can get to their values easily to write to a...
0
by: | last post by:
I have a question about spawning and displaying subordinate list controls within a list control. I'm also interested in feedback about the design of my search application. Lots of code is at the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.