Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / February 2008

Tip: Looking for answers? Try searching our database.

Custom databinding of a text box

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Keith G Hicks - 09 Feb 2008 23:36 GMT
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
Keith G Hicks - 09 Feb 2008 23:48 GMT
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.
>
[quoted text clipped - 15 lines]
>
> Keith
Jose A. Fernandez - 10 Feb 2008 00:22 GMT
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,
[quoted text clipped - 24 lines]
>
> > Keith
Keith G Hicks - 10 Feb 2008 00:52 GMT
Thank you.

> Hello Keith
> It's posible, just help with String.Concat, and Eval dataitem not use
[quoted text clipped - 49 lines]
> >
> > > Keith

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.