|
 |
aspx thread: Help With DropDownList DataBinding
Message #1 by "Douglas Rohm" <dlr@m...> on Mon, 7 Jan 2002 11:45:51 -0500
|
|
Hello,
I'm trying to bind a DataView to a DropDownList and have a question. My
DataView contains a table called Employees, which contains the first
name and last name from the Northwind database. Two of the attributes of
the DropDownList that you should use when data binding is the
DataValueField and DataTextField. My question is for the DataTextField
attribute. I'd like to combine two columns (FirstName and LastName) from
the Employees table to display the full name to the user in the
DropDownList. From what I can see and what I have messed around with,
this cannot be done. Is this true?? I find it hard to believe that I
wouldn't be able to do this with ASP.NET and ADO.NET.
Here is the code:
DataView objDataView = new DataView(objDS.Tables["Employees"]);
LastNames.DataSource = objDataView;
LastNames.DataValueField = "LastName";
LastNames.DataTextField = "LastName";
LastNames.DataBind();
Thanks in advance.
Douglas Rohm
dlr@m...
Message #2 by schmidtj@c... on Mon, 7 Jan 2002 12:44:48 -0500
|
|
I had to do the concatenation within the SQL statement to the database.
I couldn't figure out how to do it like you ideally want.
Take Care,
Jenna
-----Original Message-----
From: Douglas Rohm [mailto:dlr@m...]
Sent: Monday, January 07, 2002 11:46 AM
To: ASP+
Subject: [aspx] Help With DropDownList DataBinding
Hello,
I'm trying to bind a DataView to a DropDownList and have a question. My
DataView contains a table called Employees, which contains the first
name and last name from the Northwind database. Two of the attributes of
the DropDownList that you should use when data binding is the
DataValueField and DataTextField. My question is for the DataTextField
attribute. I'd like to combine two columns (FirstName and LastName) from
the Employees table to display the full name to the user in the
DropDownList. From what I can see and what I have messed around with,
this cannot be done. Is this true?? I find it hard to believe that I
wouldn't be able to do this with ASP.NET and ADO.NET.
Here is the code:
DataView objDataView = new DataView(objDS.Tables["Employees"]);
LastNames.DataSource = objDataView;
LastNames.DataValueField = "LastName";
LastNames.DataTextField = "LastName";
LastNames.DataBind();
Thanks in advance.
Douglas Rohm
dlr@m...
Message #3 by "Douglas Rohm" <dlr@m...> on Mon, 7 Jan 2002 14:01:02 -0500
|
|
Thanks Jenna. It made sense to do it in the SQL instead of trying to
come up with some workaround to this. I made the change to the SQL and
it works great.
Doug
-----Original Message-----
From: Schmidt, Jenna [mailto:schmidtj@c...]
Sent: Monday, January 07, 2002 12:45 PM
To: ASP+
Subject: [aspx] RE: Help With DropDownList DataBinding
I had to do the concatenation within the SQL statement to the database.
I couldn't figure out how to do it like you ideally want.
Take Care,
Jenna
-----Original Message-----
From: Douglas Rohm [mailto:dlr@m...]
Sent: Monday, January 07, 2002 11:46 AM
To: ASP+
Subject: [aspx] Help With DropDownList DataBinding
Hello,
I'm trying to bind a DataView to a DropDownList and have a question. My
DataView contains a table called Employees, which contains the first
name and last name from the Northwind database. Two of the attributes of
the DropDownList that you should use when data binding is the
DataValueField and DataTextField. My question is for the DataTextField
attribute. I'd like to combine two columns (FirstName and LastName) from
the Employees table to display the full name to the user in the
DropDownList. From what I can see and what I have messed around with,
this cannot be done. Is this true?? I find it hard to believe that I
wouldn't be able to do this with ASP.NET and ADO.NET. Here is the code:
DataView objDataView = new DataView(objDS.Tables["Employees"]);
LastNames.DataSource = objDataView;
LastNames.DataValueField = "LastName";
LastNames.DataTextField = "LastName";
LastNames.DataBind();
Thanks in advance.
Douglas Rohm
dlr@m...
Message #4 by "AAKASH" <parmarkanaiya@y...> on Tue, 8 Jan 2002 08:03:56 +0530
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_00A7_01C1981B.055E7560
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
You could have combined firstname and lastname fields in NAME from the
databae query only or from stored procedure to avoid this problem.
--------------------------------
AAKASH PARMAR (Man should not even think impossibles....)
Project Leader
Universal Software
Email : parmarkanaiya@c..., parmarkanaiya@y...
Phone: ++ 91 79 5627740 (R), 630 6028, 630 2998 (O)
----- Original Message -----
From: Douglas Rohm <dlr@m...>
Sent: Monday, January 07, 2002 10:15 PM
Subject: Help With DropDownList DataBinding
> Hello,
> I'm trying to bind a DataView to a DropDownList and have a question.
My
> DataView contains a table called Employees, which contains the first
> name and last name from the Northwind database. Two of the attributes
of
> the DropDownList that you should use when data binding is the
> DataValueField and DataTextField. My question is for the DataTextField
> attribute. I'd like to combine two columns (FirstName and LastName)
from
> the Employees table to display the full name to the user in the
> DropDownList. From what I can see and what I have messed around with,
> this cannot be done. Is this true?? I find it hard to believe that I
> wouldn't be able to do this with ASP.NET and ADO.NET.
> Here is the code:
>
> DataView objDataView =3D new DataView(objDS.Tables["Employees"]);
> LastNames.DataSource =3D objDataView;
> LastNames.DataValueField =3D "LastName";
> LastNames.DataTextField =3D "LastName";
> LastNames.DataBind();
>
> Thanks in advance.
>
> Douglas Rohm
> dlr@m...
>
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
|
|
 |