473,698 Members | 2,615 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)

Hi,

I'm trying to dynamically set the src of an iframe with the <% %> block:
<iframe id="content" src="<% = Request.QuerySt ring.Get("conte nt") %>"
width="100%"></iframe>

Notice that the tag (intentionally) has no runat=server and also nested in a
<TD> tag...

What am I doing wrong?

Thanks,
Hadar
Nov 18 '05 #1
3 17742
Hadar,

Looks like you have a balagan with quotes. Try this:
src=<% = String.Format ("'{0}'", Request.QuerySt ring.Get("conte nt") %>

Eliyahu

"Hadar" <cr****@bezeqin t.net> wrote in message
news:uB******** *****@TK2MSFTNG P12.phx.gbl...
Hi,

I'm trying to dynamically set the src of an iframe with the <% %> block:
<iframe id="content" src="<% = Request.QuerySt ring.Get("conte nt") %>"
width="100%"></iframe>

Notice that the tag (intentionally) has no runat=server and also nested in a <TD> tag...

What am I doing wrong?

Thanks,
Hadar

Nov 18 '05 #2
One more bracket:

src=<% = String.Format ("'{0}'", Request.QuerySt ring.Get("conte nt")) %>

--
Eliyahu

"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message
news:ex******** ******@TK2MSFTN GP09.phx.gbl...
Hadar,

Looks like you have a balagan with quotes. Try this:
src=<% = String.Format ("'{0}'", Request.QuerySt ring.Get("conte nt") %>

Eliyahu

"Hadar" <cr****@bezeqin t.net> wrote in message
news:uB******** *****@TK2MSFTNG P12.phx.gbl...
Hi,

I'm trying to dynamically set the src of an iframe with the <% %> block:
<iframe id="content" src="<% = Request.QuerySt ring.Get("conte nt") %>"
width="100%"></iframe>

Notice that the tag (intentionally) has no runat=server and also nested
in a
<TD> tag...

What am I doing wrong?

Thanks,
Hadar


Nov 18 '05 #3
Hi Eliyahu,

Thanks for your reply.
I tried what you suggested, and still it doesn't work (same error).
I guess it's not the quotes...

Any other suggestions?

Hadar
One more bracket:

src=<% = String.Format ("'{0}'", Request.QuerySt ring.Get("conte nt")) %>

--
Eliyahu

"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message
news:ex******** ******@TK2MSFTN GP09.phx.gbl...
Hadar,

Looks like you have a balagan with quotes. Try this:
src=<% = String.Format ("'{0}'", Request.QuerySt ring.Get("conte nt") %>

Eliyahu

"Hadar" <cr****@bezeqin t.net> wrote in message
news:uB******** *****@TK2MSFTNG P12.phx.gbl...
Hi,

I'm trying to dynamically set the src of an iframe with the <% %> block: <iframe id="content" src="<% = Request.QuerySt ring.Get("conte nt") %>" width="100%"></iframe>

Notice that the tag (intentionally) has no runat=server and also
nested in
a
<TD> tag...

What am I doing wrong?

Thanks,
Hadar



Nov 18 '05 #4

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

Similar topics

0
1119
by: Jeff Dockman | last post by:
Background: We needed the ability to create a templated web site that may change in layout from installation to installation. To accomplish this, we created a base Page class that all pages in the site inherit from. In addition to providing basic functionality and security, this Page class modifies the HtmlForm controls collection in the deriving page to manage the page layout. The Page class adds LiteralControls to manipulate the page...
5
1688
by: Jeremy Ames | last post by:
I have run into a major road block with my page development projects. I am trying to add a literal control to my asp.net page and I got an error stating that the control could not be added because of code blocks (<% %>) on the page. Most of these blocks can be handled by adding a label control to the form so it is not that big of deal, but one of the things being posted is the page title. I am not sure how I can access that from the code...
2
7361
by: Axel Dahmen | last post by:
HI, I want to dynamically add controls to a web page from within a common base class. Unfortunately, ASP.NET fails with "System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)." All of my pages contain these kind of blocks, for several reasons. For one, I don't know any other way to dynamically add header information like e.g. style sheet links to a web page. So, is...
3
4259
by: thomasamillergoogle | last post by:
Is it possible that my user control can add code to the HEAD of the parent page that hosts the control?
29
3673
by: John Rivers | last post by:
Hello, What good reason there is for not allowing methods in ASPX pages I can't imagine, but here is how to get around that limitation: (START) <body MS_POSITIONING="FlowLayout"> <form id="Form1" method="post" runat="server"> <%
0
1335
by: Dan | last post by:
Hi, I get this error: "Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>). " when trying to create a table in the code-behind file like this: dim t as table t = New Table() Page.Controls.Add(t) while the aspx file contains this:
0
1312
by: Zimmergren | last post by:
I know this has been up on googlegroups before, on several places. However, I havn't found a solution to this specific problem. I get this errormessage: "The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)." Which I get because ASP.NET uses <% ... %> tags OUTSIDE the <form> tag, meaning you can't implement it inside the form tags.
2
2003
by: CyberSoftHari | last post by:
I am adding dynamic controls in my page through a panel as figured below. pnlModel.ID = "pnlDyModel"; pnlModel.Controls.Add(lblReportTitle); pnlModel.Controls.Add(new LiteralControl("<br />")); pnlModel.Controls.Add(txtReport); pnlModel.BackColor = System.Drawing.Color.LightBlue; pnlModel.Width = 580; pnlModel.Controls.Add(tblInPanel); ...
1
1662
by: Radu | last post by:
Hi. I am trying to localize a page AND simulate the AJAX watermarks in it, i.e. the textbox contains the text "Enter your name", or "Entrez votre nom", for instance, then on click, delete this text, allow entry, but on deletion of the inputted text show again "Enter your name", or "Entrez votre nom" depending on the UICulture. Everything worked great UNTIL I have added a button which posts back. Now on postback I have the error in the...
0
8612
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
9171
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
9032
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8905
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
4373
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
4625
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3053
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
2342
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2008
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.