|
 |
aspx thread: Binding DropDownList
Message #1 by "Senthil Malathi" <senthil.malathi@a...> on Sun, 10 Dec 2000 15:00:34 +0400
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_0027_01C062B9.F27A0A50
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
I get the following error
Exception Details: System.Web.HttpException: DataBinder.Eval:
'System.Data.DataRowView' does not contain a property with the name
'tr_descr'.
for the code below to bind a dropdownlist. What is the reason?
Sub Page_Load(Src As Object, E As EventArgs)
Dim DS As DataSet
Dim MyConnection As ADOConnection
Dim MyCommand As ADODataSetCommand
dim strconn as string
dim strSQL as string
strconn="Provider=MSDAORA.1;Data Source=ms;Persist Security
Info=True;user id=user;password=pwd"
strSQL="select tr_mode, tr_descr from travel_mode_w" ' order by " &
tr_descr
MyConnection = New ADOConnection(strconn)
MyCommand = New ADODataSetCommand(strSQL,MyConnection)
DS = new DataSet()
MyCommand.FillDataSet(ds,"travel_mode_w")
cmbTravelMode.DataSource =ds.Tables("travel_mode_w").DefaultView
cmbTravelMode.DataBind()
End Sub
<asp:DropDownList id=cmbTravelMode runat="server"
DataTextField="tr_descr" DataValueField="tr_mode" />
Thanks & Regards,
S.Malathi
____________________________________
ADNOC Distribution, IT Division
P.O. 4188, Abu Dhabi, U.A.E.
Tel : +xxx x xxxxxxx
Fax: +xxx x xxxxxxx
Mobile : 050 5316055
Message #2 by Fredrik Normen <fredrik.normen@e...> on Mon, 11 Dec 2000 08:54:23 +0100
|
|
I don't think this query will work at all:
strSQL="select tr_mode, tr_descr from travel_mode_w" ' order by " & tr_descr
Try to change it to:
strSQL="select tr_mode, tr_descr from travel_mode_w order by tr_descr"
And se if this solve the problem. I think it will.
/Fredrik Normén
[Fredrik Normen] -----Origina[Fredrik Normen] l Message-----
From: Senthil Malathi [mailto:senthil.malathi@a...]
Sent: den 10 december 2000 12:01
To: ASP+
Subject: [aspx] Binding DropDownList
I get the following error
Exception Details: System.Web.HttpException: DataBinder.Eval:
'System.Data.DataRowView' does not contain a property with the name
'tr_descr'.
for the code below to bind a dropdownlist. What is the reason?
Sub Page_Load(Src As Object, E As EventArgs)
Dim DS As DataSet
Dim MyConnection As ADOConnection
Dim MyCommand As ADODataSetCommand
dim strconn as string
dim strSQL as string
strconn="Provider=MSDAORA.1;Data Source=ms;Persist Security
Info=True;user id=user;password=pwd"
strSQL="select tr_mode, tr_descr from travel_mode_w" ' order by " &
tr_descr
MyConnection = New ADOConnection(strconn)
MyCommand = New ADODataSetCommand(strSQL,MyConnection)
DS = new DataSet()
MyCommand.FillDataSet(ds,"travel_mode_w")
cmbTravelMode.DataSource =ds.Tables("travel_mode_w").DefaultView
cmbTravelMode.DataBind()
End Sub
<asp:DropDownList id=cmbTravelMode runat="server"
DataTextField="tr_descr" DataValueField="tr_mode" />
Thanks & Regards,
S.Malathi
____________________________________
ADNOC Distribution, IT Division
P.O. 4188, Abu Dhabi, U.A.E.
Tel : +xxx x xxxxxxx
Fax: +xxx x xxxxxxx
Mobile : 050 5316055
Message #3 by "Senthil Malathi" <senthil.malathi@a...> on Mon, 11 Dec 2000 13:24:08 +0400
|
|
SQL statement corrected for errors but DataBind() mthd gives the same err.
Is this mthd applicable for DropDownList?
The following code however worked.
Dim Row as DataRow
for each Row in DS.Tables("travel_mode_w").Rows
cmbTravelMode.Items.Add(New ListItem(Row(1),Row(0)))
next
-----Original Message-----
From: Fredrik Normen [mailto:fredrik.normen@e...]
Sent: Monday, December 11, 2000 11:54 AM
To: ASP+
Subject: [aspx] RE: Binding DropDownList
I don't think this query will work at all:
strSQL="select tr_mode, tr_descr from travel_mode_w" ' order by " & tr_descr
Try to change it to:
strSQL="select tr_mode, tr_descr from travel_mode_w order by tr_descr"
And se if this solve the problem. I think it will.
/Fredrik Normén
[Fredrik Normen] -----Origina[Fredrik Normen] l Message-----
From: Senthil Malathi [mailto:senthil.malathi@a...]
Sent: den 10 december 2000 12:01
To: ASP+
Subject: [aspx] Binding DropDownList
I get the following error
Exception Details: System.Web.HttpException: DataBinder.Eval:
'System.Data.DataRowView' does not contain a property with the name
'tr_descr'.
for the code below to bind a dropdownlist. What is the reason?
Sub Page_Load(Src As Object, E As EventArgs)
Dim DS As DataSet
Dim MyConnection As ADOConnection
Dim MyCommand As ADODataSetCommand
dim strconn as string
dim strSQL as string
strconn="Provider=MSDAORA.1;Data Source=ms;Persist Security
Info=True;user id=user;password=pwd"
strSQL="select tr_mode, tr_descr from travel_mode_w" ' order by " &
tr_descr
MyConnection = New ADOConnection(strconn)
MyCommand = New ADODataSetCommand(strSQL,MyConnection)
DS = new DataSet()
MyCommand.FillDataSet(ds,"travel_mode_w")
cmbTravelMode.DataSource =ds.Tables("travel_mode_w").DefaultView
cmbTravelMode.DataBind()
End Sub
<asp:DropDownList id=cmbTravelMode runat="server"
DataTextField="tr_descr" DataValueField="tr_mode" />
Thanks & Regards,
S.Malathi
____________________________________
ADNOC Distribution, IT Division
P.O. 4188, Abu Dhabi, U.A.E.
Tel : +xxx x xxxxxxx
Fax: +xxx x xxxxxxx
Mobile : 050 5316055
|
|
 |