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