473,383 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Assigning 2 Databinding Expressions To The Same Property

I have two databinding expressions (the first & last names from a DB) that I
want to assign to the text property of a Label so that the result is
LASTNAME,FIRSTNAME. At the moment, I have the following which I know works
when I use it by itself:

text='<%# DataBinder.Eval(Container,"DataItem.membernames.ln ame") %>'

What I need to do is somehow concatenate this databinding expression, a
comma, and another databinding expression for the first name (which looks
almost the same). How can I do this? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
Nov 21 '05 #1
4 1194
text='<%# DataBinder.Eval(Container,"DataItem.membernames.ln ame") %>,<%#
DataBinder.Eval(Container,"DataItem.membernames.fn ame") %>'


"Nathan Sokalski" <nj********@hotmail.com> wrote in message
news:es**************@TK2MSFTNGP12.phx.gbl...
I have two databinding expressions (the first & last names from a DB) that
I want to assign to the text property of a Label so that the result is
LASTNAME,FIRSTNAME. At the moment, I have the following which I know works
when I use it by itself:

text='<%# DataBinder.Eval(Container,"DataItem.membernames.ln ame") %>'

What I need to do is somehow concatenate this databinding expression, a
comma, and another databinding expression for the first name (which looks
almost the same). How can I do this? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

Nov 21 '05 #2
That was my original attempt, but it gives me an error when I try to use it.
Here is the error I recieve when trying to do it that way:

Server Error in '/' Application.
--------------------------------------------------------------------------------

Compilation Error
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.

Compiler Error Message: BC30037: Character is not valid.

Source Error:
Line 45: <asp:Label id="lblOrganization1" runat="server"
EnableViewState="False" Width="175px" text='<%#
DataBinder.Eval(Container,"DataItem.members.organi zation") %>'>
Line 46: </asp:Label>
Line 47: <asp:Label id="lblName1" runat="server"
EnableViewState="False" Width="175px" text='<%#
DataBinder.Eval(Container,"DataItem.membernames.ln ame") %>,<%#
DataBinder.Eval(Container,"DataItem.membernames.fn ame") %>'>
Line 48: </asp:Label>
Line 49: <asp:Label id="lblRegion1" runat="server"
EnableViewState="False" Width="125px" text='<%#
DataBinder.Eval(Container,"DataItem.pacounties.reg ion") %>'>

Source File:
D:\Clients\12654\papresenters.org\papresenters.org \membersearch.aspx
Line: 47

If you want to see the "Detailed Compiler Output" or "Complete Compilation
Source" (they were too long to put in a newsgroup posting) let me know and I
will be happy to email them to you. Thank you for any help you can give.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Scott M." <s-***@nospam.nospam> wrote in message
news:OI**************@TK2MSFTNGP14.phx.gbl...
text='<%# DataBinder.Eval(Container,"DataItem.membernames.ln ame") %>,<%#
DataBinder.Eval(Container,"DataItem.membernames.fn ame") %>'


"Nathan Sokalski" <nj********@hotmail.com> wrote in message
news:es**************@TK2MSFTNGP12.phx.gbl...
I have two databinding expressions (the first & last names from a DB) that
I want to assign to the text property of a Label so that the result is
LASTNAME,FIRSTNAME. At the moment, I have the following which I know works
when I use it by itself:

text='<%# DataBinder.Eval(Container,"DataItem.membernames.ln ame") %>'

What I need to do is somehow concatenate this databinding expression, a
comma, and another databinding expression for the first name (which looks
almost the same). How can I do this? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/


Nov 21 '05 #3
Ok, try this then:

text='<%# DataBinder.Eval(Container,"DataItem.membernames.ln ame"), %><%#
DataBinder.Eval(Container,"DataItem.membernames.fn ame") %>'

"Nathan Sokalski" <nj********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
That was my original attempt, but it gives me an error when I try to use
it. Here is the error I recieve when trying to do it that way:

Server Error in '/' Application.
--------------------------------------------------------------------------------

Compilation Error
Description: An error occurred during the compilation of a resource
required to service this request. Please review the following specific
error details and modify your source code appropriately.

Compiler Error Message: BC30037: Character is not valid.

Source Error:
Line 45: <asp:Label id="lblOrganization1" runat="server"
EnableViewState="False" Width="175px" text='<%#
DataBinder.Eval(Container,"DataItem.members.organi zation") %>'>
Line 46: </asp:Label>
Line 47: <asp:Label id="lblName1" runat="server" EnableViewState="False"
Width="175px" text='<%#
DataBinder.Eval(Container,"DataItem.membernames.ln ame") %>,<%#
DataBinder.Eval(Container,"DataItem.membernames.fn ame") %>'>
Line 48: </asp:Label>
Line 49: <asp:Label id="lblRegion1" runat="server" EnableViewState="False"
Width="125px" text='<%#
DataBinder.Eval(Container,"DataItem.pacounties.reg ion") %>'>

Source File:
D:\Clients\12654\papresenters.org\papresenters.org \membersearch.aspx Line:
47

If you want to see the "Detailed Compiler Output" or "Complete Compilation
Source" (they were too long to put in a newsgroup posting) let me know and
I will be happy to email them to you. Thank you for any help you can give.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Scott M." <s-***@nospam.nospam> wrote in message
news:OI**************@TK2MSFTNGP14.phx.gbl...
text='<%# DataBinder.Eval(Container,"DataItem.membernames.ln ame") %>,<%#
DataBinder.Eval(Container,"DataItem.membernames.fn ame") %>'


"Nathan Sokalski" <nj********@hotmail.com> wrote in message
news:es**************@TK2MSFTNGP12.phx.gbl...
I have two databinding expressions (the first & last names from a DB)
that I want to assign to the text property of a Label so that the result
is LASTNAME,FIRSTNAME. At the moment, I have the following which I know
works when I use it by itself:

text='<%# DataBinder.Eval(Container,"DataItem.membernames.ln ame") %>'

What I need to do is somehow concatenate this databinding expression, a
comma, and another databinding expression for the first name (which
looks almost the same). How can I do this? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/



Nov 21 '05 #4
I tried that, I got the same result as before:

Server Error in '/' Application.
--------------------------------------------------------------------------------

Compilation Error
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.

Compiler Error Message: BC30037: Character is not valid.

Source Error:

Line 45: <asp:Label id="lblOrganization1" runat="server"
EnableViewState="False" Width="175px" text='<%#
DataBinder.Eval(Container,"DataItem.members.organi zation") %>'>
Line 46: </asp:Label>
Line 47: <asp:Label id="lblName1" runat="server"
EnableViewState="False" Width="175px" text='<%#
DataBinder.Eval(Container,"DataItem.membernames.ln ame"), %><%#
DataBinder.Eval(Container,"DataItem.membernames.fn ame") %>'>
Line 48: </asp:Label>
Line 49: <asp:Label id="lblRegion1" runat="server"
EnableViewState="False" Width="125px" text='<%#
DataBinder.Eval(Container,"DataItem.pacounties.reg ion") %>'>
Source File:
D:\Clients\12654\papresenters.org\papresenters.org \membersearch.aspx
Line: 47
I think, although I am not sure because I am not an expert on databinding,
that the two values need to be concatenated either somehow in the codebehind
file or using some kind of formatting technique. I have seen formatting
methods (not in databinding, but in other areas) where the format string
uses numbers to represent the different values in the same way that 0 is
often used in DataBinder.Eval's optional third parameter. I was wondering if
there was some way to do something similar to this (the only problem is that
I don't know of a way to create more than one value). Let me know if you
find any more ideas. Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Scott M." <s-***@nospam.nospam> wrote in message
news:uR****************@tk2msftngp13.phx.gbl...
Ok, try this then:

text='<%# DataBinder.Eval(Container,"DataItem.membernames.ln ame"), %><%#
DataBinder.Eval(Container,"DataItem.membernames.fn ame") %>'

"Nathan Sokalski" <nj********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
That was my original attempt, but it gives me an error when I try to use
it. Here is the error I recieve when trying to do it that way:

Server Error in '/' Application.
--------------------------------------------------------------------------------

Compilation Error
Description: An error occurred during the compilation of a resource
required to service this request. Please review the following specific
error details and modify your source code appropriately.

Compiler Error Message: BC30037: Character is not valid.

Source Error:
Line 45: <asp:Label id="lblOrganization1" runat="server"
EnableViewState="False" Width="175px" text='<%#
DataBinder.Eval(Container,"DataItem.members.organi zation") %>'>
Line 46: </asp:Label>
Line 47: <asp:Label id="lblName1" runat="server" EnableViewState="False"
Width="175px" text='<%#
DataBinder.Eval(Container,"DataItem.membernames.ln ame") %>,<%#
DataBinder.Eval(Container,"DataItem.membernames.fn ame") %>'>
Line 48: </asp:Label>
Line 49: <asp:Label id="lblRegion1" runat="server"
EnableViewState="False" Width="125px" text='<%#
DataBinder.Eval(Container,"DataItem.pacounties.reg ion") %>'>

Source File:
D:\Clients\12654\papresenters.org\papresenters.org \membersearch.aspx
Line: 47

If you want to see the "Detailed Compiler Output" or "Complete
Compilation Source" (they were too long to put in a newsgroup posting)
let me know and I will be happy to email them to you. Thank you for any
help you can give.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Scott M." <s-***@nospam.nospam> wrote in message
news:OI**************@TK2MSFTNGP14.phx.gbl...
text='<%# DataBinder.Eval(Container,"DataItem.membernames.ln ame") %>,<%#
DataBinder.Eval(Container,"DataItem.membernames.fn ame") %>'


"Nathan Sokalski" <nj********@hotmail.com> wrote in message
news:es**************@TK2MSFTNGP12.phx.gbl...
I have two databinding expressions (the first & last names from a DB)
that I want to assign to the text property of a Label so that the result
is LASTNAME,FIRSTNAME. At the moment, I have the following which I know
works when I use it by itself:

text='<%# DataBinder.Eval(Container,"DataItem.membernames.ln ame") %>'

What I need to do is somehow concatenate this databinding expression, a
comma, and another databinding expression for the first name (which
looks almost the same). How can I do this? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/



Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jason Wright via .NET 247 | last post by:
Hiya, I've created a UserControl with some Custom properties and assigned databinding expressions to the properties in the aspx. Does anyone know why these expressions are not being evaluated? ...
4
by: Nathan Sokalski | last post by:
I have two databinding expressions (the first & last names from a DB) that I want to assign to the text property of a Label so that the result is LASTNAME,FIRSTNAME. At the moment, I have the...
6
by: Nathan Sokalski | last post by:
I am using a DataSet as the DataSource of a DataList in my code. The SQL used to get the data from the database begins with: SELECT...
2
by: Mr Newbie | last post by:
Ive got the basic idea behind DataBinding Expressions, but I have a couple of questions, Ok its four actually :) Q1.) It would appear that if you use Page.DataBind that all child controls and...
4
by: sydney.luu | last post by:
Hi, I want to assign two data values in the CommandArgument property of the LinkButton object. This works CommandArgument='<%#DataBinder.Eval(Container.DataItem, "Arg1")%>' but this does...
0
by: dba123 | last post by:
In my GridView I have this: <Columns> <asp:TemplateField HeaderText="Title" SortExpression='<%#((Podcast)Container.DataItem).Title %>'> <ItemTemplate> <asp:Image ID="Image1"...
8
by: Dirk | last post by:
Hello, I have a problem to use databinding with my business layer classes. My data class does not have simple properties (string, int or datetime), instead, all my properties are objects of the...
1
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= | last post by:
Hello to all, I want to know if DataBinding in asp.net 2,0 is better than to fill up the values of the controls of the following form: this.miControlTextBox.Text = valorParaControlTextbox; ...
3
by: Peter | last post by:
Hi! I am having some very strange behavior with my databound controls. It's taken a long time to isolate exactly what is provoking the problem, but I'm still leagues away from solving it. I...
4
by: Jason Wolf | last post by:
I have an object which runs in a sperate thread, from the main thread, and while running it updates a public property. In my main form I defined databinding on the property and I would like to see...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.