473,549 Members | 2,751 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems with Drop Down List Control

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_D ataBound(object sender, EventArgs e)
{
DropDownList1.I tems.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.co m/">
<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="#FFEAA D"><div align="left">
<p style="margin-left: 10"><span class="topnav">
<a href="index.asp x">London</a><font color="#4A494A" >
&gt; Landing Page Category</font></span></div>
</td>
<td width="16">
<p><img src="../../images/nav_rghtcrnr.gi f" 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">&nb sp;</td>
</tr>
</table></td>
</tr>
<tr>
<td><img src="../../images/yellw_top2.gif" width="780"
height="29"></td>
</tr>
<tr>
<td bgcolor="#FFD34 C">
<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:SqlDataSou rce ID="SqlDataSour ce1" runat="server"
ConnectionStrin g="<%$ ConnectionStrin gs:eventcalenda rConnectionStri ng3
%>"
ProviderName="< %$
ConnectionStrin gs:eventcalenda rConnectionStri ng3.ProviderNam e %>"
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">

<SelectParamete rs>
<asp:ControlPar ameter ControlID="Drop DownList1"
Name="city" PropertyName="S electedValue" />
</SelectParameter s></asp:SqlDataSour ce>

<asp:SqlDataSou rce ID="SqlDataSour ce2" runat="server"
ConnectionStrin g="<%$ ConnectionStrin gs:eventcalenda rConnectionStri ng3
%>"
ProviderName="< %$
ConnectionStrin gs:eventcalenda rConnectionStri ng3.ProviderNam e %>"
SelectCommand=" SELECT * FROM tbl_users where
for_city='Londo n' and service_type='c hild care' and status='Active' ">
</asp:SqlDataSour ce>
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_listi ng_new.aspx">Su bmit Your
Business Listing or Event for FREE!</a><br />
</span>
<br />
<table border="0" bordercolor="#1 11111" cellpadding="0"
cellspacing="0" height="30"
style="border-collapse: collapse" width="100%">
<tr>
<td bgcolor="#00000 0" 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">D ownload
<font
color="#ff0000" ><b>FUN!</b></fontto 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>
<asp:DropDownLi st ID="DropDownLis t1" runat="server" AutoPostBack="T rue"
DataSourceID="S qlDataSource2" DataTextField=" city"
DataValueField= "city" OnDataBound="Dr opDownList1_Dat aBound">
</asp:DropDownLis t></td>
</tr>
</table>

<asp:DataList ID="dlFreebies " Runat="server"
DataSourceID="S qlDataSource1" RepeatColumns=" 2"
RepeatDirection ="Horizontal " RepeatLayout="T able" 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="#fffff f" valign="top"
style="backgrou nd-color: #ffd34c; font-size: 10pt; color: black;
font-family: Arial; vertical-align: middle; height: 33px;"><img
src="../../images/docs_link_icon. gif" border="0">&nbs p;<strong><span
style="color: #ffffff; text-decoration: underline"></span></strong><a
href="news_deta ils.aspx?user_i d=<%# DataBinder.Eval (Container.Data Item,
"user_id") %>"><%# DataBinder.Eval (Container.Data Item, "organizati on")
%></td>
</tr>
<tr>

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

</ItemTemplate>

</asp:DataList>
<table border="0" bordercolor="#1 11111" 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="#1 11111" 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">Calend ar 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.ht m">
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_land ing.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">&n bsp;</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.gi f" width="15"
height="38"></td>
<td width="749" background="../../images/ftr_bkgrnd.gif"
class="bottomna v"<br&copy; 2006
All rights reserved.</td>
<td width="16">
<img src="../../images/ftr_rightside.g if" width="16"
height="38"></td>
</tr>
</table></td>
</tr>
</table>
</form></body>
</html>

Nov 20 '06 #1
0 1607

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

Similar topics

1
3432
by: Dec | last post by:
Ok to simplify things I'll just give an example. This is pretty much what I want to do (minus the postcode): http://www.perrys.co.uk/usedcar?ID=F5J9BNNBMVK00DF I have relatively little experience with databases (hate being a n00b) but I'm currently attempting to put myself through some sort of crash course.. How far have I got? Ok so...
3
6143
by: Don Wash | last post by:
Hi There! I have a Server-side Drop-down box in ASP.NET (VB) page. What do I do to widen the Drop down box's Pull-Down list's width? I'm not talking about the Drop-down box's width but the box that appear when user clicks the drop-down arrow button. Because items in the Drop down list are a little long, user can't see the full thing when...
13
5222
by: Leszek Taratuta | last post by:
Hello, I have several drop-down lists on my ASP.NET page. I need to keep data sources of these lists in Session State. What would be the most effective method to serialize this kind of data structures? Thanks for any hints, Leszek Taratuta
2
12600
by: Yoshitha | last post by:
hi I have 2 drop down lists in my application.1st list ontains itmes like java,jsp,swings,vb.net etc.2nd list contains percentage i.e it conatains the items like 50,60,70,80,90,100. i will select any skill in 1st drop down list then i'll select % of this skill in the 2nd list box , based on the percentage i've selected in the 2nd list...
2
1098
by: ASP.Net Event not firing | last post by:
Hi, I would like to use Panels in my ASP.Net code. It works OK if I put static controls on it but if I have a drop down list or a listbox control that need to have 'EnablePostBack' = true then the SelectedIndexChanged event does not fire. In the case of the Drop down list control I get an error 'Failed to Load ViewState etc....' For the...
1
1045
by: clickon | last post by:
I want to use the selected value of a drop down list to filter a data source. When i have done this before i have used a DataSourceControl and i have just made the drop down a control parameter, which works well. However this time i need to combine a set of results from two databases into a single data source so i need to use ADO to do it. ...
1
1519
by: clickon | last post by:
I want to use the selected value of a drop down list to filter a data source. When i have done this before i have used a DataSourceControl and i have just made the drop down a control parameter, which works well. However this time i need to combine a set of results from two databases into a single data source so i need to use ADO to do it. ...
1
5395
by: clickon | last post by:
Forget about the controlParameter for the moment, for testing purposes i have created the following Markup: <asp:Table ID="tblSelectRoute" runat="server" CssClass="asp-table"> <asp:TableRow> <asp:TableCell CssClass="asp-table-header">Select Route<asp:Label ID="lblTest" runat="server"></asp:Label> </asp:TableCell>
8
7563
by: Ed Dror | last post by:
Hi there ASP.NET 2.0 VB & SQL Express Lest take Northwind Categories Products as example I create a table that hold these two together and I create a stored procedure like select ProductID, ProductName, CategoryID, from tblCategoryProducts Where (CategoryID = @CategoryID)
1
1987
by: jacbyrd | last post by:
I have created a user control that is a drop down list that pulls from my database. I then drop that control into a detailsview control on an insert item template. When I run the insert command, the drop down list control isn't returning a value. How can I pass the value from the drop down list control into the Insert Command Parameters? ...
0
7477
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...
0
7991
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...
0
7838
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...
0
6084
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5396
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...
0
3524
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...
1
1971
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
1
1084
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
790
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.