473,671 Members | 2,384 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Add attribute - apparently I have to

I have the following line of code in a code-behind file. It's part of a
event which is run when a user clicks an asp:imagebutton on a page.

tblMainImage.Ro ws[0].Cells[0].Attributes.Add ("background ",
"../images/albums/" & Request.QuerySt ring("d") & "/" &
RowView("strFil ename") & ".jpg")

However, when I view the page I get an error message with this line
highlighted, saying:

'Property access must assign to the property or use its value.'

Am I not assigning to the property with the line I'm using??? I'm adding the
attribute so surely I'm assigning to it? I've looked at lots of past posts
and they all seem to indicate using the syntax above. So where am I going
wrong?! Thanks in advance to anyone who can point me in the right direction.

Haydn
Nov 18 '05 #1
5 1184
"Haydnw" <ha****@removey ahooremove.com> wrote in message
news:ur******** *****@TK2MSFTNG P12.phx.gbl...
I have the following line of code in a code-behind file. It's part of a
event which is run when a user clicks an asp:imagebutton on a page.

tblMainImage.Ro ws[0].Cells[0].Attributes.Add ("background ",
"../images/albums/" & Request.QuerySt ring("d") & "/" &
RowView("strFil ename") & ".jpg")

However, when I view the page I get an error message with this line
highlighted, saying:

'Property access must assign to the property or use its value.'

Am I not assigning to the property with the line I'm using??? I'm adding the attribute so surely I'm assigning to it? I've looked at lots of past posts
and they all seem to indicate using the syntax above. So where am I going
wrong?! Thanks in advance to anyone who can point me in the right

direction.

Haydn,

Simplify the situation by replacing the attribute value with "x" and see
what happens:

tblMainImage.Ro ws[0].Cells[0].Attributes.Add ("background ", "x")

--
John Saunders
johnwsaundersii i at hotmail
Nov 18 '05 #2
I'm a bit confused here - if this is VB.NET code, shouldn't those []
brackets be () ones?

Steve

"Haydnw" <ha****@removey ahooremove.com> wrote in message
news:ur******** *****@TK2MSFTNG P12.phx.gbl...
I have the following line of code in a code-behind file. It's part of a
event which is run when a user clicks an asp:imagebutton on a page.

tblMainImage.Ro ws[0].Cells[0].Attributes.Add ("background ",
"../images/albums/" & Request.QuerySt ring("d") & "/" &
RowView("strFil ename") & ".jpg")

However, when I view the page I get an error message with this line
highlighted, saying:

'Property access must assign to the property or use its value.'

Am I not assigning to the property with the line I'm using??? I'm adding the attribute so surely I'm assigning to it? I've looked at lots of past posts
and they all seem to indicate using the syntax above. So where am I going
wrong?! Thanks in advance to anyone who can point me in the right direction.
Haydn

Nov 18 '05 #3
Hi John,

Thanks for the quick response! I had tried something similar, but have just
tried it again with "x" to be on the safe side. I get exactly the same error
(obviously with all my concatenation junk in the first post replaced with
"x").

Any other ideas? :) I'm starting to go out of my mind trying to figure this
one out!!

Cheers,
Haydn

"John Saunders" <jo************ **@notcoldmail. com> wrote in message
news:OK******** ******@TK2MSFTN GP12.phx.gbl...
"Haydnw" <ha****@removey ahooremove.com> wrote in message
news:ur******** *****@TK2MSFTNG P12.phx.gbl...
I have the following line of code in a code-behind file. It's part of a
event which is run when a user clicks an asp:imagebutton on a page.

tblMainImage.Ro ws[0].Cells[0].Attributes.Add ("background ",
"../images/albums/" & Request.QuerySt ring("d") & "/" &
RowView("strFil ename") & ".jpg")

However, when I view the page I get an error message with this line
highlighted, saying:

'Property access must assign to the property or use its value.'

Am I not assigning to the property with the line I'm using??? I'm adding

the
attribute so surely I'm assigning to it? I've looked at lots of past posts and they all seem to indicate using the syntax above. So where am I going wrong?! Thanks in advance to anyone who can point me in the right

direction.

Haydn,

Simplify the situation by replacing the attribute value with "x" and see
what happens:

tblMainImage.Ro ws[0].Cells[0].Attributes.Add ("background ", "x")

--
John Saunders
johnwsaundersii i at hotmail

Nov 18 '05 #4
Erm...yes. Yes they should.

*Shuffles off into the corner looking sheepish...*

Cheers guys. :)

H

"Steve Willcock" <st***@N-O-S-P-A-Mwillcockconsul ting.com> wrote in message
news:cf******** ***********@new s.demon.co.uk.. .
I'm a bit confused here - if this is VB.NET code, shouldn't those []
brackets be () ones?

Steve

"Haydnw" <ha****@removey ahooremove.com> wrote in message
news:ur******** *****@TK2MSFTNG P12.phx.gbl...
I have the following line of code in a code-behind file. It's part of a
event which is run when a user clicks an asp:imagebutton on a page.

tblMainImage.Ro ws[0].Cells[0].Attributes.Add ("background ",
"../images/albums/" & Request.QuerySt ring("d") & "/" &
RowView("strFil ename") & ".jpg")

However, when I view the page I get an error message with this line
highlighted, saying:

'Property access must assign to the property or use its value.'

Am I not assigning to the property with the line I'm using??? I'm adding

the
attribute so surely I'm assigning to it? I've looked at lots of past posts and they all seem to indicate using the syntax above. So where am I going wrong?! Thanks in advance to anyone who can point me in the right

direction.

Haydn


Nov 18 '05 #5
AttributeCollec tion coll = tblMainImage.Ro ws[0].Cells[0].Attributes;
coll.Add("backg round", "x");
--
John Saunders
johnwsaundersii i at hotmail

"Haydnw" <ha****@removey ahooremove.com> wrote in message
news:u5******** ******@TK2MSFTN GP10.phx.gbl...
Hi John,

Thanks for the quick response! I had tried something similar, but have just tried it again with "x" to be on the safe side. I get exactly the same error (obviously with all my concatenation junk in the first post replaced with
"x").

Any other ideas? :) I'm starting to go out of my mind trying to figure this one out!!

Cheers,
Haydn

"John Saunders" <jo************ **@notcoldmail. com> wrote in message
news:OK******** ******@TK2MSFTN GP12.phx.gbl...
"Haydnw" <ha****@removey ahooremove.com> wrote in message
news:ur******** *****@TK2MSFTNG P12.phx.gbl...
I have the following line of code in a code-behind file. It's part of a event which is run when a user clicks an asp:imagebutton on a page.

tblMainImage.Ro ws[0].Cells[0].Attributes.Add ("background ",
"../images/albums/" & Request.QuerySt ring("d") & "/" &
RowView("strFil ename") & ".jpg")

However, when I view the page I get an error message with this line
highlighted, saying:

'Property access must assign to the property or use its value.'

Am I not assigning to the property with the line I'm using??? I'm
adding
the
attribute so surely I'm assigning to it? I've looked at lots of past

posts and they all seem to indicate using the syntax above. So where am I going wrong?! Thanks in advance to anyone who can point me in the right

direction.

Haydn,

Simplify the situation by replacing the attribute value with "x" and see
what happens:

tblMainImage.Ro ws[0].Cells[0].Attributes.Add ("background ", "x")

--
John Saunders
johnwsaundersii i at hotmail


Nov 18 '05 #6

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

Similar topics

2
1687
by: James Lapalme | last post by:
Hy, I understand that attribute programming is used to add metadata to the code, but since they are implemented with a class and we can extend that class, we should be able to do any normal class thing with attributes like: -Have methods -Use any kind of code in the constructor and the methods (ex. Use a MessageBox) But the run time will not execute a MessageBox in the constructor?? why?
4
2480
by: Grant Edwards | last post by:
I'm using xml.sax to parse the "datebook" xml file generated by QTopiaDesktop. When I look at the xml file, some of the attribute strings have newlines in them (as they are supposed to). However, when xml.sax passes the attributes to my startElement() method the newlines seem to have been deleted. How do I get the un-munged element attribute values?
6
3407
by: Martin Plantec | last post by:
Hi again, If I may, I have another, slightly more complex, XSLT question. (I'm learning, but it's not as easy as I would have thought!) I would like a rule that says: for every element that has an attribute "webclass", rename the attribute as "class", keeping the same value for the attribute (and keeping the same element name). In other words, I would like to rename an attribute, whatever the element it comes in. I gather it is...
4
12983
by: Arjen | last post by:
Hi, I have a class with some attributes. For example class person with name as attribute. I have add multiple persons in an arraylist. Now I need a function to get/find a person by the name attribute. This function returns the index or the object. I can do this with a foreach statement. I think there are better solutions,
3
6039
by: ADavidson | last post by:
I'm getting a {"Parser Error: The Runat attribute must have the value Server." } error when I try to get the Server.GetlastError() in the Global.asax codebehind. Why am I getting this? I tried to remove the code-behind and add the <script language="C#" runat="server"> but that fails as well. The code is simply:
2
1726
by: gary.goodwin | last post by:
HI I am trying to understand Attribute usage. For example the class SerializableAttribute is a class correct? So why when it is actually u sed the "Attribute" portion of the name is dropped. The sam is true of the AttributeUsageAttribute class and on and on. I don't get it. Gary
1
7766
by: perspolis | last post by:
Hi all I created a Web Project but it dosen't support some properties of HTML tags and it gives me following error: Attribute 'height' is not a valid attribute of element 'table' I don't know why?/ thanks in advance
2
2122
by: =?Utf-8?B?U2VyZ2lvIE1hcnRpbnM=?= | last post by:
Hi. I have an ActiveX DLL, developed in Visual Basic 6.0 and I need to use that DLL inside an ASP.NET application, developed in Visual Basic .Net 2003. My problem is that in my machine I get the error "QueryInterface for interface ... failed" when I try to use same method of the ActiveX DLL. I try the same application in another machine and everything works fine. I found that if I set the "AspCompat=True" attribute in the page the...
2
8748
by: Nathan Sokalski | last post by:
I am attempting to create icons for controls I have created using VB.NET by using the System.Drawing.ToolboxBitmap attribute. I have managed to do this in C# by specifying the path to the *.ico file, but I have been unable to get any of the overloads to work in VB.NET. I would like to store the *.ico files in a *.resx file so that users do not need anything other than the *.dll, but at the moment I am just trying to get any of the overloads...
0
8400
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8924
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...
1
8602
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8672
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...
1
6234
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
4227
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
4412
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2058
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1814
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.