473,394 Members | 1,726 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,394 software developers and data experts.

Problem calling Anchors

I have manually written an achor in the HTML mode like this:

<a name="expenses"></a>

Then at a button_click() I have this code in the code behind:
Page.Controls.Add(New LiteralControl("<script language = ""javascript"">"))

Page.Controls.Add(New LiteralControl("document.location.hash=""expenses" ""))

Page.Controls.Add(New LiteralControl("</script>"))

----------------------------------------------------

This normaly works fine but not on this page cause I have added some own
javascript with errortexts that comes from <%... %> links... so I get the
following error message when clicking the button.

The Controls collection cannot be modified because the control contains code
blocks (i.e. <% ... %>).
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Web.HttpException: The Controls collection cannot
be modified because the control contains code blocks (i.e. <% ... %>).

Source Error:

Line 680: btnAddnewLodging.Enabled = False
Line 681:
Line 682: Page.Controls.Add(New LiteralControl("<script language =
""javascript"">"))
Line 683: Page.Controls.Add(New
LiteralControl("document.location.hash=""lodging"" "))
Line 684: Page.Controls.Add(New LiteralControl("</script>"))
------------------

This of course is bad and I need to find another way of adding the
"#expenses" to the URL.. and why is the javascript I wrote considered to be
part of the control i'm adding?

Please help

Best Regards/

Lars Neztel
Nov 19 '05 #1
0 909

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

Similar topics

7
by: Ben Wilson | last post by:
To anyone who can help me, you have my thanks in advance. I am implementing a "301 Moved Permanently" redirect in my website due to a change of our domain names. Unfortunately, I am having a...
6
by: PhillyFan | last post by:
I have a page setup using anchors. For some reason not all the anchors are working correctly. The last three anchors do not start where they are supposed to. I then started removing the anchor...
1
by: void | last post by:
Please take a look at this page: http://home.comcast.net/~delerious1/index5.html It behaves as I expect in Mozilla and Opera, but there are two glaring differences in IE (5.5): 1) The anchors...
1
by: delerious | last post by:
Could someone please take a look at this page: http://home.comcast.net/~delerious1/index11.html The set of links on the left should not have any whitespace between them, and the set of links...
2
by: learner | last post by:
Hi, A document has many Anchors. I want to take a particular action only if some particular anchors are clicked. I mean if some anchors are clicked, i want an alert box to pop up with ok and...
21
by: adrian suri | last post by:
Hi just started to experement with styleshhets, and have defined hover a:hover { Color : red; Text-decoration : none; Border-top-width : medium; Border-right-width : medium;
18
by: Simula | last post by:
I am developing an HTML javascript application and I want to preserve state in a way that can be book-marked. I chose HTML anchors as a means of preserving state. When the application changes...
10
by: elibol | last post by:
Hi, Is there an event that fires when the back or forward button on a browser is pressed? I need an event to fire when someone clicks the back or forward button after an anchor has been set. ...
8
by: David C. Stone | last post by:
I'm stuck trying to validate an html 4.01 page that uses an image map. I copied the second client-side example from here: <http://www.w3.org/TR/html401/struct/objects.html#h-13.6> and...
8
by: knoxautoguy | last post by:
This problem has consumed a lot of my time, and I'm aftraid someone will tell me that my whole approach to this objective is wrong; however, I would like to know if there is a way to do this. I...
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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...

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.