-----Original Message-----
You need to use the HtmlGenericControl. The code below is a code-behind version
of an example near the bottom of this page:
http://msdn.microsoft.com/library/default.asp? url=/library/en-
us/cpgenref/html/cpconhtmlgenericcontrol.asp
Does this help?
Ken
MVP [ASP.NET]
Public Class bdycolour
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
End Sub
Protected WithEvents ColorSelect As System.Web.UI.HtmlControls.HtmlSelect
Protected WithEvents Submit1 As System.Web.UI.HtmlControls.HtmlInputButton
'NOTE: The following placeholder declaration is required by the Web Form
Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
Public Sub SubmitBtn_Click _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Submit1.ServerClick
Dim Body As New HtmlGenericControl
Body = Page.Controls(1)
Body.Attributes("bgcolor") = ColorSelect.Value
End Sub
End Class
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="bdycolour.aspx.vb"
Inherits="p733workev.bdycolour"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>bdycolour</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="
http://schemas.microsoft.com/intellisense/ie5">
</head>
<body id="Body" runat="server">
<h3>Updating Styles with the HtmlGenericControl</h3>
<form runat="server" id="Form1">
<p>
Select a background color for the page:
<p>
<select id="ColorSelect" runat="server" name="ColorSelect">
<option selected>White</option>
<option>Wheat</option>
<option>Gainsboro</option>
<option>LemonChiffon</option>
</select>
<input type="submit" runat="server" value="Apply"
onserverclick="SubmitBtn_Click" id="Submit1"
name="Submit1">
</form>
</P>
</body>
</html>
--
Microsoft MVPs have a question for *you*: Are you patched against the Worm?
http://www.microsoft.com/security/security_bulletins/ms03- 026.asp
Is there a way to change the background color of a web
form on the server before it is posted? In the pageLoad
event I can do it to server controls by adding an
attribute, however, how do I do the same for the page's
background color?
Should be simple I think?
Jerry J
.