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>
<aspropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
DataSourceID="SqlDataSource2" DataTextField="city"
DataValueField="city" OnDataBound="DropDownList1_DataBound">
</aspropDownList>
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>
<aspropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
DataSourceID="SqlDataSource2" DataTextField="city"
DataValueField="city" OnDataBound="DropDownList1_DataBound">
</aspropDownList>