473,715 Members | 5,223 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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,FIRSTN AME. At the moment, I have the following which I know works
when I use it by itself:

text='<%# DataBinder.Eval (Container,"Dat aItem.membernam es.lname") %>'

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********@hotm ail.com
http://www.nathansokalski.com/
Nov 19 '05 #1
4 1656
text='<%# DataBinder.Eval (Container,"Dat aItem.membernam es.lname") %>,<%#
DataBinder.Eval (Container,"Dat aItem.membernam es.fname") %>'


"Nathan Sokalski" <nj********@hot mail.com> wrote in message
news:es******** ******@TK2MSFTN GP12.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,FIRST NAME. At the moment, I have the following which I know works
when I use it by itself:

text='<%# DataBinder.Eval (Container,"Dat aItem.membernam es.lname") %>'

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********@hotm ail.com
http://www.nathansokalski.com/

Nov 19 '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="lblOrganiza tion1" runat="server"
EnableViewState ="False" Width="175px" text='<%#
DataBinder.Eval (Container,"Dat aItem.members.o rganization") %>'>
Line 46: </asp:Label>
Line 47: <asp:Label id="lblName1" runat="server"
EnableViewState ="False" Width="175px" text='<%#
DataBinder.Eval (Container,"Dat aItem.membernam es.lname") %>,<%#
DataBinder.Eval (Container,"Dat aItem.membernam es.fname") %>'>
Line 48: </asp:Label>
Line 49: <asp:Label id="lblRegion1 " runat="server"
EnableViewState ="False" Width="125px" text='<%#
DataBinder.Eval (Container,"Dat aItem.pacountie s.region") %>'>

Source File:
D:\Clients\1265 4\papresenters. org\papresenter s.org\membersea rch.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********@hotm ail.com
http://www.nathansokalski.com/

"Scott M." <s-***@nospam.nosp am> wrote in message
news:OI******** ******@TK2MSFTN GP14.phx.gbl...
text='<%# DataBinder.Eval (Container,"Dat aItem.membernam es.lname") %>,<%#
DataBinder.Eval (Container,"Dat aItem.membernam es.fname") %>'


"Nathan Sokalski" <nj********@hot mail.com> wrote in message
news:es******** ******@TK2MSFTN GP12.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,FIRS TNAME. At the moment, I have the following which I know works
when I use it by itself:

text='<%# DataBinder.Eval (Container,"Dat aItem.membernam es.lname") %>'

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********@hotm ail.com
http://www.nathansokalski.com/


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

text='<%# DataBinder.Eval (Container,"Dat aItem.membernam es.lname"), %><%#
DataBinder.Eval (Container,"Dat aItem.membernam es.fname") %>'

"Nathan Sokalski" <nj********@hot mail.com> wrote in message
news:%2******** ********@TK2MSF TNGP14.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="lblOrganiza tion1" runat="server"
EnableViewState ="False" Width="175px" text='<%#
DataBinder.Eval (Container,"Dat aItem.members.o rganization") %>'>
Line 46: </asp:Label>
Line 47: <asp:Label id="lblName1" runat="server" EnableViewState ="False"
Width="175px" text='<%#
DataBinder.Eval (Container,"Dat aItem.membernam es.lname") %>,<%#
DataBinder.Eval (Container,"Dat aItem.membernam es.fname") %>'>
Line 48: </asp:Label>
Line 49: <asp:Label id="lblRegion1 " runat="server" EnableViewState ="False"
Width="125px" text='<%#
DataBinder.Eval (Container,"Dat aItem.pacountie s.region") %>'>

Source File:
D:\Clients\1265 4\papresenters. org\papresenter s.org\membersea rch.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********@hotm ail.com
http://www.nathansokalski.com/

"Scott M." <s-***@nospam.nosp am> wrote in message
news:OI******** ******@TK2MSFTN GP14.phx.gbl...
text='<%# DataBinder.Eval (Container,"Dat aItem.membernam es.lname") %>,<%#
DataBinder.Eval (Container,"Dat aItem.membernam es.fname") %>'


"Nathan Sokalski" <nj********@hot mail.com> wrote in message
news:es******** ******@TK2MSFTN GP12.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,FIRSTN AME. At the moment, I have the following which I know
works when I use it by itself:

text='<%# DataBinder.Eval (Container,"Dat aItem.membernam es.lname") %>'

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********@hotm ail.com
http://www.nathansokalski.com/



Nov 19 '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="lblOrganiza tion1" runat="server"
EnableViewState ="False" Width="175px" text='<%#
DataBinder.Eval (Container,"Dat aItem.members.o rganization") %>'>
Line 46: </asp:Label>
Line 47: <asp:Label id="lblName1" runat="server"
EnableViewState ="False" Width="175px" text='<%#
DataBinder.Eval (Container,"Dat aItem.membernam es.lname"), %><%#
DataBinder.Eval (Container,"Dat aItem.membernam es.fname") %>'>
Line 48: </asp:Label>
Line 49: <asp:Label id="lblRegion1 " runat="server"
EnableViewState ="False" Width="125px" text='<%#
DataBinder.Eval (Container,"Dat aItem.pacountie s.region") %>'>
Source File:
D:\Clients\1265 4\papresenters. org\papresenter s.org\membersea rch.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********@hotm ail.com
http://www.nathansokalski.com/

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

text='<%# DataBinder.Eval (Container,"Dat aItem.membernam es.lname"), %><%#
DataBinder.Eval (Container,"Dat aItem.membernam es.fname") %>'

"Nathan Sokalski" <nj********@hot mail.com> wrote in message
news:%2******** ********@TK2MSF TNGP14.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="lblOrganiza tion1" runat="server"
EnableViewState ="False" Width="175px" text='<%#
DataBinder.Eval (Container,"Dat aItem.members.o rganization") %>'>
Line 46: </asp:Label>
Line 47: <asp:Label id="lblName1" runat="server" EnableViewState ="False"
Width="175px" text='<%#
DataBinder.Eval (Container,"Dat aItem.membernam es.lname") %>,<%#
DataBinder.Eval (Container,"Dat aItem.membernam es.fname") %>'>
Line 48: </asp:Label>
Line 49: <asp:Label id="lblRegion1 " runat="server"
EnableViewState ="False" Width="125px" text='<%#
DataBinder.Eval (Container,"Dat aItem.pacountie s.region") %>'>

Source File:
D:\Clients\1265 4\papresenters. org\papresenter s.org\membersea rch.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********@hotm ail.com
http://www.nathansokalski.com/

"Scott M." <s-***@nospam.nosp am> wrote in message
news:OI******** ******@TK2MSFTN GP14.phx.gbl...
text='<%# DataBinder.Eval (Container,"Dat aItem.membernam es.lname") %>,<%#
DataBinder.Eval (Container,"Dat aItem.membernam es.fname") %>'


"Nathan Sokalski" <nj********@hot mail.com> wrote in message
news:es******** ******@TK2MSFTN GP12.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,FIRSTN AME. At the moment, I have the following which I know
works when I use it by itself:

text='<%# DataBinder.Eval (Container,"Dat aItem.membernam es.lname") %>'

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********@hotm ail.com
http://www.nathansokalski.com/



Nov 19 '05 #5

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

Similar topics

2
1666
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? eg. <uc1:ControlX id="la" runat="server" ClientClick='javascriptfunction(<%# DataBinder.Eval(Container.DataItem, "Id")%>)' /> after processing renders in html as <table id="la" onclick="javascriptfunction(<%#...
6
2310
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 members.organization,artists.artist,artists.email,artists.website,members.email FROM members INNER JOIN artists ON members.memberid=artists.memberid WHERE Notice that both tables involved in the SELECT statement have a field named
2
1689
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 the page get bound to their respective DataSources, is this correct ? and if so why would you need to individually bind controls, why not jsut use Page.DataBind everytime?, Im sure there is a good reason why not but I cant think of one at the...
4
1205
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 following which I know works when I use it by itself: text='<%# DataBinder.Eval(Container,"DataItem.membernames.lname") %>' What I need to do is somehow concatenate this databinding expression, a comma, and another databinding expression for the...
4
3530
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 not work CommandArgument='<%#DataBinder.Eval(Container.DataItem,
0
4815
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" ImageUrl="~/images/interact/icon_podcast.gif" runat="server" /> <asp:HyperLink ID="Title" runat="server" Text='<%#((Podcast)Container.DataItem).Title %>'
1
1626
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; Performance with databinding is good in asp.net 2.0 ? Would you prefer: databinding or set value to Text property of control ?
3
1886
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 have a DataView which filters a DataSet. Bound to this dataview is a ListBox, via its DataSource property. The DisplayMember is the name property of the row. Simple enough so far?
4
3317
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 this databinding update my form property to reflect the value of the other components property, but it does not happen. My binding is Databinding.Add("Text",renderEngine,"Framerate"); When the property is initially set, to minus one, the text...
0
9340
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9047
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7973
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6646
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4477
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4738
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3175
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2539
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2118
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.