DropDownList - binding data

G

Guest

Hi

I'm trying to do something really simple - bind data from
my database to a dropdownlist but I can display the list
but it contains nothing.

Here's my html:
<asp:DropDownList ID="LangDropDownList"
DataTextField="TASK_NAME" DataValueField="TASK_NAME"
DataSource='<%# TempDataView %>' Width="120px"
Runat="server" />

and my C#:
String strCmd1 = "Select TASK.TASK_NAME FROM TASK";

DataSet ds = new DataSet();
OleDbDataAdapter da;
string connectionString=ConfigurationSettings.AppSettings
["ConnectionString"];
OleDbConnection conn = new OleDbConnection
(connectionString);
da = new OleDbDataAdapter(strCmd1, conn);
da.Fill(ds,"TaskTable");
TempDataView=ds.Tables["TaskTable"].DefaultView;

I would like to use TempDataView so that I can details the
datasource in the html because I intend to go on and use
this inside a datagrid. So while I could set the
datasource and then bind the dropdownlist I would like to
know how to do it this way by setting the datasource in
the html to either a DataView object or a method?

Any help much appreciated.

Thanks in advance.
 

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

Similar Threads


Members online

Forum statistics

Threads
474,083
Messages
2,570,591
Members
47,212
Latest member
RobynWiley

Latest Threads

Top