Drop Down List Issue

D

Derty

Have a problem with a drop down list that is used to filter results
from mysql table. The dropdownlist popluates with table entries but i
can't get the parameter to pass to the sql statement correctly. Any
help is appreciated. Here's some code:



<%@ Page language="C#" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<script runat="server">

protected void DropDownList1_DataBound(object sender, EventArgs e)
{
DropDownList1.Items.Insert(0, new ListItem("-- All Cities --",
"0"));
}
</script>

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:eventcalendarConnectionString3
%>"

ProviderName="<%$
ConnectionStrings:eventcalendarConnectionString3.ProviderName %>"
SelectCommand="SELECT organization, user_id, city FROM tbl_users WHERE
for_city = 'London' AND service_type = 'child care' AND status =
'Active' AND city = city limit 30">

<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" Name="city"
PropertyName="SelectedValue" />
</SelectParameters></asp:SqlDataSource>

<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:eventcalendarConnectionString3
%>"ProviderName="<%$
ConnectionStrings:eventcalendarConnectionString3.ProviderName %>"
SelectCommand="SELECT * FROM tbl_users where for_city='London' and
service_type='child care' and status='Active'">
</asp:SqlDataSource>

<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
DataSourceID="SqlDataSource2" DataTextField="city"
DataValueField="city" OnDataBound="DropDownList1_DataBound">
</asp:DropDownList>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top