Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Formatting URL Text


Message #1 by "Hugh McLaughlin" <hugh@k...> on Sun, 20 Jan 2002 18:38:12
Hello everyone and thaks for your help in advance.  I am working with a 

datagrid in which I want to create a hyperlink with text Last Nmae, First 

Name with the text being the individuals last name and first name 

separated by a comma.  I ave used the DataTextField prpperty to 

successfuly bind one column to the text, but cannot seem to get it to 

handle more than one column.  I have tried:



 DataTextField="<%# Container.DataItem("LastName") & Container.DataItem

("FirstName")  %>"



but this gives me an error.  Ant help would be greatly appreciated.  

Thanks.
Message #2 by "Greg Quinn" <greg@i...> on Mon, 21 Jan 2002 09:27:47 -0800
Maybe try



DataTextField = "<%# Container.DataItem("LastName") %>"

DataTextField += "<%# Container.DataItem("FirstName") %>"



Not sure if it will work though...



-----Original Message-----

From: Hugh McLaughlin [mailto:hugh@k...]

Sent: 20 January 2002 06:38

To: ASP+

Subject: [aspx] Formatting URL Text





Hello everyone and thaks for your help in advance.  I am working with a 

datagrid in which I want to create a hyperlink with text Last Nmae, First 

Name with the text being the individuals last name and first name 

separated by a comma.  I ave used the DataTextField prpperty to 

successfuly bind one column to the text, but cannot seem to get it to 

handle more than one column.  I have tried:



 DataTextField="<%# Container.DataItem("LastName") & Container.DataItem

("FirstName")  %>"



but this gives me an error.  Ant help would be greatly appreciated.  

Thanks.




Message #3 by "Hugh McLaughlin" <hugh@k...> on Mon, 21 Jan 2002 12:25:27
> Maybe try

> 

> DataTextField = "<%# Container.DataItem("LastName") %>"

> DataTextField += "<%# Container.DataItem("FirstName") %>"

> 

> Not sure if it will work though...

> 

> -----Original Message-----

> From: Hugh McLaughlin [mailto:hugh@k...]

> Sent: 20 January 2002 06:38

> To: ASP+

> Subject: [aspx] Formatting URL Text

> 

> 

> Hello everyone and thaks for your help in advance.  I am working with a 

> datagrid in which I want to create a hyperlink with text Last Nmae, 

First 

> Name with the text being the individuals last name and first name 

> separated by a comma.  I ave used the DataTextField prpperty to 

> successfuly bind one column to the text, but cannot seem to get it to 

> handle more than one column.  I have tried:

> 

>  DataTextField="<%# Container.DataItem("LastName") & Container.DataItem

> ("FirstName")  %>"

> 

> but this gives me an error.  Ant help would be greatly appreciated.  

> Thanks.




The Container.DataItem throws off an error message.  It only seems to 

allow the colmun name.
Message #4 by "Douglas Rohm" <dlr@m...> on Mon, 21 Jan 2002 19:37:42 -0500
Hi Hugh,

I had this same problem before.  There isn't a way to bind more than one

DataColumn to the DataTextField or DataValueField.  The way I got around

it was to let the actual SQL statement do the concatenation for me.



string strSQL = "SELECT FirstName + ' ' + LastName AS Name, LastName

FROM Employees";



Doug



-----Original Message-----

From: Hugh McLaughlin [mailto:hugh@k...] 

Sent: Sunday, January 20, 2002 6:38 PM

To: ASP+

Subject: [aspx] Formatting URL Text





Hello everyone and thaks for your help in advance.  I am working with a 

datagrid in which I want to create a hyperlink with text Last Nmae,

First 

Name with the text being the individuals last name and first name 

separated by a comma.  I ave used the DataTextField prpperty to 

successfuly bind one column to the text, but cannot seem to get it to 

handle more than one column.  I have tried:



 DataTextField="<%# Container.DataItem("LastName") & Container.DataItem

("FirstName")  %>"



but this gives me an error.  Ant help would be greatly appreciated.  

Thanks.







  Return to Index