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:
<aspropDownList 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.
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:
<aspropDownList 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.