By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,027 Members | 1,111 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,027 IT Pros & Developers. It's quick & easy.

Assigning 2 Databinding Expressions To The Same Property

P: n/a
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 19 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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 19 '05 #2

P: n/a
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 19 '05 #3

P: n/a
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 19 '05 #4

P: n/a
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 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.