Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Problems with Drop Down List Control

Reply
Thread Tools

Problems with Drop Down List Control

 
 
Derty
Guest
Posts: n/a
 
      11-20-2006
Have an issue with a simple drop down list that I need to filter
results of a database table and page display. I can get the drop down
list to populate correctly but can't make the page databound items
change with selection. I've included my code below. Any help is
appreciated:




<%@ 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>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<link href="../../styles.css" rel="stylesheet" type="text/css">
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form id="form1" runat="server">
<table width="780" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr>
<td><table width="780" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="780" border="0" cellspacing="0"
cellpadding="0">
<tr>
<td width="89">
<img src="../../images/kids_logo.gif" border="0"
width="124" height="84"></td>
<td width="301">
<img src="../../images/blue.gif" width="371"
height="84" id="IMG1"></td>
<td width="195">
<img src="../../images/kids.jpg" width="222"
height="84"></td>
<td width="195">
<a href="http://www.nineblue.com/">
<img src="../../images/n_logo.gif" border="0"
width="63" height="84"></a></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="780" border="0" cellspacing="0"
cellpadding="0">
<tr>
<td width="63">
<img src="../../images/klogo_crnr.gif" width="63"
height="18"></td>
<td width="701" bgcolor="#FFEAAD"><div align="left">
<p style="margin-left: 10"><span class="topnav">
<a href="index.aspx">London</a><font color="#4A494A">
&gt; Landing Page Category</font></span></div>
</td>
<td width="16">
<p><img src="../../images/nav_rghtcrnr.gif" width="16"
height="18"></p>
</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="780" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td width="570">
<p align="center">

<a href="../signup.aspx">
</a></td>
<td width="210">&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td><img src="../../images/yellw_top2.gif" width="780"
height="29"></td>
</tr>
<tr>
<td bgcolor="#FFD34C">
<table width="778" border="0" cellpadding="0" cellspacing="0"
id="TABLE2">
<tr>
<td valign="top" style="width: 197px">&nbsp;</td>
<td width="450" valign="top" style="font-size: 14pt; color:
black; font-family: 'Arial Black'">
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:eventcalendarConnectionString3
%>"
ProviderName="<%$
ConnectionStrings:eventcalendarConnectionString3.P roviderName %>"
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.P roviderName %>"
SelectCommand="SELECT * FROM tbl_users where
for_city='London' and service_type='child care' and status='Active'">
</asp:SqlDataSource>
London Hotels <br />
<span style="font-size: 10pt; font-family: Arial">Blah,
blah, blah, blah<br />
<strong><span style="color: #0000ff; text-decoration:
underline"></span></strong><a href="biz_listing_new.aspx">Submit Your
Business Listing or Event for FREE!</a><br />
</span>
<br />
<table border="0" bordercolor="#111111" cellpadding="0"
cellspacing="0" height="30"
style="border-collapse: collapse" width="100%">
<tr>
<td bgcolor="#000000" colspan="4" height="22"
width="100%">
<p style="margin-left: 5px">
<b><font color="#ffffff"
size="2">&nbsp;Family Attractions Guide</font></b></p>
</td>
</tr>
<tr>
<td height="15" width="19%">
</td>
<td height="15" width="31%">
</td>
<td height="15" width="21%">
</td>
<td height="15" width="29%">
</td>
</tr>
<tr>
<td height="15" valign="top" width="19%">
<p align="center">
<a href="http://www.blah.com/fun/fun.htm"
target="_new">
<img border="0" height="58"
src="../../images/fun_icon.gif"
width="59" /></a></p>
</td>
<td colspan="3" height="15" valign="top"
width="81%">
<p style="margin-top: 0px; margin-bottom:
0px; margin-left: 5px">
<u><font size="2"><a
href="http://www.blah.com/fun/fun.htm" target="_new">Download
<font
color="#ff0000"><b>FUN!</b></font> to Your Computer!</a></font></u></p>
<p style="margin-top: 0px; margin-bottom:
0px; margin-left: 5px">
<font face="Arial"
size="2">Family-friendly events in sixteen cities delivered right
to your computer! Now that's <font
color="#ff0000"><b>FUN!</b></font></font></p>
</td>
</tr>
<tr>
<td width="19%" style="height: 25px">
</td>
<td width="31%" style="height: 25px">
</td>
<td colspan="2" style="height: 25px; text-align:
right">
<span style="font-weight: normal; font-size:
10pt">Find by area </span>
<aspropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
DataSourceID="SqlDataSource2" DataTextField="city"
DataValueField="city" OnDataBound="DropDownList1_DataBound">
</aspropDownList></td>
</tr>
</table>

<aspataList ID="dlFreebies" Runat="server"
DataSourceID="SqlDataSource1" RepeatColumns="2"
RepeatDirection="Horizontal" RepeatLayout="Table" Width="447px"
style="padding-right: 5px">
<ItemStyle VerticalAlign="Top"></ItemStyle>
<ItemTemplate>
<table width=180>
<tr>
<td width=180 valign="top" align="center">
<DIV style="BORDER-RIGHT: #22610d 0px; BORDER-TOP: #22610d 0px;
BORDER-LEFT: #22610d 0px; width=165; BORDER-BOTTOM: #22610d 0px;
valign=top; height: 29px;">
<table id="Table1" cellspacing="0" cellpadding="0" border="0"
align="center" style="width: 218px">
<tr>
<td align="left" bgcolor="#ffffff" valign="top"
style="background-color: #ffd34c; font-size: 10pt; color: black;
font-family: Arial; vertical-align: middle; height: 33px;"><img
src="../../images/docs_link_icon.gif" border="0">&nbsp;<strong><span
style="color: #ffffff; text-decoration: underline"></span></strong><a
href="news_details.aspx?user_id=<%# DataBinder.Eval(Container.DataItem,
"user_id") %>"><%# DataBinder.Eval(Container.DataItem, "organization")
%></td>
</tr>
<tr>

</table>
</DIV>
</td>
</tr>
</table>

</ItemTemplate>

</aspataList>
<table border="0" bordercolor="#111111" cellpadding="0"
cellspacing="0" height="31"
style="border-collapse: collapse" width="102%">
<tr>
<td colspan="4" height="15" width="100%">
<div align="center">
<center>
&nbsp;</center>
<center>
<table border="0"
bordercolor="#111111" cellpadding="0" cellspacing="0" height="189"
style="border-collapse: collapse"
width="284">
<tr>
<td colspan="4" height="39"
valign="bottom" width="301">
<img border="0"
height="39" src="../../images/box_top.gif"
width="299" /></td>
</tr>
<tr>
<td
background="../../images/box_leftyellow.gif"
height="136" rowspan="6"
valign="top" width="5">
&nbsp;</td>
<td width="19">
<p>
</p>
</td>
<td width="251">
</td>
<td
background="../../images/box_rightyellow.gif"
height="136" rowspan="6"
width="20">
&nbsp;</td>
</tr>
<tr>
<td align="right" width="19">
<font size="2">
<img align="right"
border="0" height="17" src="../../images/icon_check.gif"
width="19"
/></font></td>
<td width="251">
<a
href="calendar.aspx"><font size="2">Calendar of Kid-Friendly
Events</font></a></td>
</tr>
<tr>
<td align="right" width="19">
<font size="2">
<img align="right"
border="0" height="17" src="../../images/icon_check.gif"
width="19"
/></font></td>
<td width="251">
<font size="2"><a
href="anding.htm">
Hotels for
Kids</a></font></td>
</tr>
<tr>
<td align="right" width="19">
<font size="2">
<img align="right"
border="0" height="17" src="../../images/icon_check.gif"
width="19"
/></font></td>
<td width="251">
<font size="2"><a
href="news_landing.htm">

Contribute</a></font></td>
</tr>
<tr>
<td align="right" width="19">
<font size="2">
<img align="right"
border="0" height="17" src="../../images/icon_check.gif"
width="19"
/></font></td>
<td width="251">
<font size="2"><a
href="Freebies.aspx">Freebies
&amp;
Cheapies</a></font></td>
</tr>
<tr>
<td height="3" width="19">
</td>
<td height="3" width="251">
</td>
</tr>
<tr>
<td colspan="4" height="14"
width="295">
<img border="0"
height="14" src="../../images/box_bottom.gif"
width="299" /></td>
</tr>
</table>
</center>
</div>
</td>
</tr>
</table>
</td>
<td width="164" valign="top">&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td><img src="../../images/yellw_btm.gif" width="780"
height="25"></td>
</tr>
<tr>
<td><table width="780" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="15">
<img src="../../images/ftr_leftside.gif" width="15"
height="38"></td>
<td width="749" background="../../images/ftr_bkgrnd.gif"
class="bottomnav"> <br> &copy; 2006
All rights reserved.</td>
<td width="16">
<img src="../../images/ftr_rightside.gif" width="16"
height="38"></td>
</tr>
</table></td>
</tr>
</table>
</form></body>
</html>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Affecting a dynamically created drop down from another dynamically created drop down. msimmons ASP .Net 0 07-16-2009 03:17 PM
retrive preselected value in second drop down list from the first drop down list weiwei ASP .Net 0 01-05-2007 07:29 PM
Multiple select drop down poplulating sub drop down scott@dettcom.com Javascript 3 11-09-2006 07:50 PM
Auto Drop down a Drop Down List xxbmichae1@supergambler.com Javascript 5 11-23-2005 01:35 AM
New to .NET, can I have one drop down box control the data of another drop down box using a database? SirPoonga ASP .Net 2 01-07-2005 10:44 PM



Advertisments