473,508 Members | 2,326 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Question: Change page.Controls(1) from HtmlForm to HtmlGenericControl

I have 2 webforms. When I print out the page.Controls(1).tostring variable
one says "HtmlForm", the other "HtmlGenericControl". How can I change the
first one to "HtmlForm"?

? page.Controls(1).tostring
"System.Web.UI.HtmlControls.HtmlForm"

? page.Controls(1).tostring
"System.Web.UI.HtmlControls.HtmlGenericControl "

The reason why is that I am trying to change the forms background color
based on a value in my web.config file.

This is how I am doing it:
' set background color based on web.config setting
Dim Body As New HtmlGenericControl
Body = CType(Page.Controls(1), HtmlGenericControl)
Body.Attributes("bgcolor") =
ConfigurationSettings.AppSettings("BackgroundColor ")
Nov 18 '05 #1
0 1270

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

Similar topics

0
2262
by: Matthias Lohrer | last post by:
Hi, I'm playing around with the possibilities of Page.ParseControl. Thanks to Kirk Allen Evans I got my example running (Posting Juli, 17, "Re: Generating ASP.NET-Controls with XSLT...
1
1293
by: sc | last post by:
From my codebehind, I am trying to get an object reference to the current form, so I can perform a FindControl and work with one of the child controls. My problem is that I never know the name...
8
1339
by: VB Programmer | last post by:
I have code that changes the bkground color of the webform on page_load. Here it is: Dim Body As New HtmlGenericControl Body = CType(Page.Controls(1), HtmlGenericControl)...
0
283
by: VB Programmer | last post by:
I have 2 webforms. When I print out the page.Controls(1).tostring variable one says "HtmlForm", the other "HtmlGenericControl". How can I change the first one to "HtmlForm"? ?...
0
1279
by: seven | last post by:
I have a base page with an HTMLForm object (added to the base page control heiarchy during Init). In the design of pages derived from this base page, I can choose to create controls and add them...
14
8147
by: Laser Lu | last post by:
Hello, All, I just want to know that generally how to get the HtmlForm element in an ASP.NET Page? Can anybody help? Please:) Best regards, Laser Lu
5
1724
by: Nathan Sokalski | last post by:
When I view my index.aspx page any time after the first time, I recieve the following error: System.Web.TraceContext.AddNewControl(String id, String parentId, String type, Int32 viewStateSize)...
2
1689
by: Lloyd Dupont | last post by:
In a C# Web Control library I created this Page / HttpHandler: ================ namespace WebUtils { public class FTBImageGallery : Page { public override void ProcessRequest(HttpContext...
2
261
by: Kevin Blount | last post by:
I'm trying to create a mutli-form page on my website, but having trouble with the PostBack stuff. And yes, I'm new to C# - my background of 8yrs is original ASP, and I'm getting easily confused...
5
2800
by: =?Utf-8?B?V2FubmFiZQ==?= | last post by:
We have a page that is loading very slow. There is not a lot of data, not a lot of users are connected at the same time and the page does not produce an error, so I am not sure where to start to...
0
7118
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...
0
7323
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,...
1
7038
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...
0
7493
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...
0
5625
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,...
1
5049
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...
0
4706
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3180
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
763
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.