473,811 Members | 3,256 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Question about querystring

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

After user selected a state and a city and clicked the
btnfindrestarua nts 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.QuerySt ring("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 btnFindRestaura nts_Click(ByVal sender As System.Object,
ByVal e As System.EventArg s) Handles btnFindRestaura nts.Click

Response.Redire ct("storelist.a spx?City=" + ddlCity.Selecte dItem.Text +
"&State=" + ddlState.Select edItem.Text, True)

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

In storelist.aspx

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) 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.QuerySt ring("State")
City = Request.QuerySt ring("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( "CountStore s")
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 1137
My guess would be that you are re-binding the dropdownlist in
restaurant.aspx before the SelectedItem property is accessed in
btnFindRestaura nts_Click.

Nov 19 '05 #2

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

Similar topics

13
4759
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 like this: %@ Language=VBScript %> <!--#include file="includes/openconnection.asp"-->
0
1405
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 unlock the software through a registry entry Here is my problem. It seems that many of my users are having trouble due to new firewall applications and hardware devices that are blocking their computers from receiving the response code for the...
9
1656
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") response.write("<TABLE ALIGN=CENTER>")
17
2653
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 directly. so I need a way doing this. so I check to see if the ifp value is null and if so then assign it a value. is this correct?
9
6033
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 index and get the key then the item out of the query string...
7
1441
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
1871
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 submit button, but when I'm getting the form collection (using post or get (form/querystring) I can't retrieve that
7
3948
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, correctly. However, when I click on a menu item in that page, it then executes the same page load twice, before transferring control (via a response.redirect) to the new page. On the first pass through the page load of the menu page, the session...
10
3444
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 database or continue to process on to the next page. I am now trying to learn ASP to see if we can replace some of our applications that were written in php with an ASP alternative. However, after doing many searches on google and reading a couple...
0
2086
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 end of this message, but I will start with an overview of the problem. I've made a content management solution for my work with a decently structured relational database system. The CMS stores articles. The CMS also stores related items --...
0
9731
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9605
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10393
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10405
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10136
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7671
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5556
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4342
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3871
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.