473,513 Members | 2,505 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DropDownList in a Repeater

Hi

Can this be done?

I can display this on the web page (so presumably some/all
of the HTML is fine) but what I cannot do is get the data
from the database to bind itself to the list. I've tried a
few code variations but my latest is:

OleDbConnection conn = null;
OleDbDataReader reader = null;
OleDbDataAdapter myadapter;

string connectionString=ConfigurationSettings.AppSettings
["ConnectionString"];

conn = new OleDbConnection(connectionString);
OleDbCommand cmd=new OleDbCommand();
cmd.CommandType=CommandType.StoredProcedure;
cmd.Connection=conn;
cmd.CommandText="[TASKDETAILS]";

myadapter=new OleDbDataAdapter(cmd);

try
{
conn.Open();
reader=cmd.ExecuteReader(CommandBehavior.CloseConn ection);
}
catch (Exception e)
{
Response.Write(e.Message);
Response.End();
}

TaskRepeater.DataSource=reader;
TaskRepeater.DataBind();

and in the HTML it's:
<asp:Repeater id="TaskRepeater" runat="server">
<HeaderTemplate>
<table border="0" width="594">
<tr>
<td align="left">Task</td>
<td align="left">Project</td>
<td align="left">Language</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td width="150">
<%# DataBinder.Eval(Container.DataItem,"TASK_NAME") %>
</td>
<td width="150">
<%# DataBinder.Eval(Container.DataItem,"LANG_NAME") %>
</td>
<td width="150">
<asp:dropdownlist Width="88px" ID="LanguageDropDownList"
CssClass="Standard-text" DataSource='<%# DataBinder.Eval
(Container.DataItem,"LANG_NAME") %>'
DataTextField="LANG_NAME" DataValueField="LANG_NAME"
Runat="server"/>
</asp:dropdownlist>
</td>

Unfortunately, this gives me the error message:
DataBinder.Eval: 'System.Char' does not contain a property
with the name LANG_NAME.
I know that my SQL is correct since I've double checked
that LANG_NAME comes through elsewhere.

Can anyone help me out?
Thanks in advance.
Nov 18 '05 #1
0 1011

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

Similar topics

0
2412
by: kamaumalone | last post by:
I have a dropdownlist which lives inside of a repeater. The repeater accepts user input via textboxes and the aforementioned dropdownlist. The repeater accepts phone numbers and allows for an...
7
6970
by: Darren | last post by:
Hi There, I am developing a shopping cart web application in C#. Product pricing for an item changes based on the weight of product purchased. ie: 100g=$4.95, 200g=$7.95, etc. Pricing is...
1
16858
by: Shaun Camilleri | last post by:
Hi all, I am creating a DropDownList in a RepeaterControl. After the Repeater is DataBound in the ItemCreated event (of the Repeater) I bind the DropDownList to a Table and then try to select one...
1
2146
by: Joe Gass | last post by:
I'd like to bind some xml to a dropdownlist <engines> <engine name="test1" id="1" /> <engine name="test2" id="2" /> </engines> If I do: ddlEngines.DataSource =...
4
5098
by: jjack100 | last post by:
I have a DropDownList that is nested inside a Repeater. The datasource of the DropDownList is declared in the aspx, not the codebehind. So we have this: <asp:Repeater ID="rptOptions"...
1
2693
by: Jeremy | last post by:
Hello All, I have a Repeater which contains a Dynamic DropDownList within its itemtemplate. I know I have struggled with this before and I am pretty sure I had to save a bunch of crap manually...
1
520
by: Eugene Anthony | last post by:
ModifyUserRegistration.aspx --------------------------- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="ModifyUserRegistration.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC...
0
1187
by: stretch73 | last post by:
I have a repeater control with a DropDownList in the header template. I am trying to make a database call and sort the results by the selectedIndex property of the drop down. The...
3
2715
by: gsauns | last post by:
Hello, I have an ASP.NET app with a DropDownList on the page, which is bound to values from a table. I have a Repeater control on the page whose displayed data is dependent on the DropDownList...
2
3730
by: MattB | last post by:
I have a (.Net 1.1) form with a Repeater and a DropDownList in the ItemTemplate. I programmatically make the DDL Autopostback = true at runtime based on the bound data. That works - I can see the...
0
7161
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...
0
7384
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7101
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7525
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...
0
5686
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,...
1
5089
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...
0
3234
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...
0
1596
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 ...
0
456
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...

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.