Custom databinding of a text box

K

Keith G Hicks

vwd 2005 express.

when editing the CUSTOM databinding of a text box in a FormViews
"ItemTemplate" I'd like to do this:

Bind("[FirstName] & ' ' & [LastName]")

Or if you prefer, this is the resultant ASP code from setting the property
above:
<asp:Label ID="FirstNameLabel" runat="server" Text="<%#
Bind(&quot;[FirstName] & ' ' & [LastName]&quot;) %>"
Width="312px"></asp:Label>

but that doesn't work. How do I construct the string so that the result is
the concatenation of the FirstName and the LastName?



Thanks,



Keith
 
K

Keith G Hicks

I should point out that I know I can modify my SQL statement to return a
column of the concatenated values or use a view that does the same. HOWEVER,
one of the things many of the SQL gurus yell at everyone for over and over
and over is DO THE FORMATTING IN THE CLIENT SIDE!!! NOT THE SQL SIDE!!!. I
don't always agree with that philosophy but I'd like to know how to do this
on the ASP side of things if it's possible.

Keith
 
J

Jose A. Fernandez

Hello Keith
It's posible, just help with String.Concat, and Eval dataitem not use
Bind...
Example:
<asp:FormView ID="FormView1"
....
<ItemTemplate>
....
<asp:Label ID="lblDesc" runat="server" Text='<%#
String.Concat(Eval("CategoryID"), Eval("Description"),
Eval("CategoryID")) %>'>
....


Links:
-----------------
String..Concat Method
Concatenates one or more instances of String, or the String
representations of the values of one or more instances of Object.
http://msdn2.microsoft.com/en-us/library/system.string.concat.aspx

I hope that you will help or guide
______________________
Jose A. Fernandez
blog: http://geeks.ms/blogs/fernandezja




I should point out that I know I can modify my SQL statement to return a
column of the concatenated values or use a view that does the same. HOWEVER,
one of the things many of the SQL gurus yell at everyone for over and over
and over is DO THE FORMATTING IN THE CLIENT SIDE!!! NOT THE SQL SIDE!!!. I
don't always agree with that philosophy but I'd like to know how to do this
on the ASP side of things if it's possible.

Keith

Keith G Hicks said:
vwd 2005 express.
when editing the CUSTOM databinding of a text box in a FormViews
"ItemTemplate" I'd like to do this:
Bind("[FirstName] & ' ' & [LastName]")
Or if you prefer, this is the resultant ASP code from setting the property
above:
<asp:Label ID="FirstNameLabel" runat="server" Text="<%#
Bind(&quot;[FirstName] & ' ' & [LastName]&quot;) %>"
Width="312px"></asp:Label>
but that doesn't work. How do I construct the string so that the result is
the concatenation of the FirstName and the LastName?

Keith
 
K

Keith G Hicks

Thank you.

Jose A. Fernandez said:
Hello Keith
It's posible, just help with String.Concat, and Eval dataitem not use
Bind...
Example:
<asp:FormView ID="FormView1"
....
<ItemTemplate>
....
<asp:Label ID="lblDesc" runat="server" Text='<%#
String.Concat(Eval("CategoryID"), Eval("Description"),
Eval("CategoryID")) %>'>
....


Links:
-----------------
String..Concat Method
Concatenates one or more instances of String, or the String
representations of the values of one or more instances of Object.
http://msdn2.microsoft.com/en-us/library/system.string.concat.aspx

I hope that you will help or guide
______________________
Jose A. Fernandez
blog: http://geeks.ms/blogs/fernandezja




I should point out that I know I can modify my SQL statement to return a
column of the concatenated values or use a view that does the same. HOWEVER,
one of the things many of the SQL gurus yell at everyone for over and over
and over is DO THE FORMATTING IN THE CLIENT SIDE!!! NOT THE SQL SIDE!!!. I
don't always agree with that philosophy but I'd like to know how to do this
on the ASP side of things if it's possible.

Keith

vwd 2005 express.
when editing the CUSTOM databinding of a text box in a FormViews
"ItemTemplate" I'd like to do this:
Bind("[FirstName] & ' ' & [LastName]")
Or if you prefer, this is the resultant ASP code from setting the property
above:
<asp:Label ID="FirstNameLabel" runat="server" Text="<%#
Bind(&quot;[FirstName] & ' ' & [LastName]&quot;) %>"
Width="312px"></asp:Label>
but that doesn't work. How do I construct the string so that the result is
the concatenation of the FirstName and the LastName?

Keith
 

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

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top