Hi flyguy,
I can see your intension is to mark the "Hello World!!!" as html, therefore
you enclosed it in tag "<html></html>".
First, innerHTML is not a server-side property, it's a client-side property
(
http://msdn2.microsoft.com/en-us/library/ms533897.aspx). You can use any
html source to set to this property, for example: <h1>Hello World!!!</h1>.
However, "<html></html>" is also a valid html tag which normally used in
the most outside of the html source.
To set the html inside the Panel at server-side, you can create a literal
control with the html source and add the control to the Panel:
LiteralControl lc = new LiteralControl( "<h1>Hello World!!!</h1>");
panel1.Controls .Add(lc);
To set the html inside the Panel at client-side, you can use:
<%@ Page Language="C#" AutoEventWireup ="true" CodeFile="Defau lt.aspx.cs"
Inherits="_Defa ult" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitl ed Page</title>
<script type="text/javascript" language="javas cript">
function test()
{
var panel2 = document.getEle mentById('panel 2');
panel2.innerHTM L = "<h1>Hello JavaScript!!!</h1>";
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Panel ID="panel1" runat="server"> </asp:Panel>
<asp:Panel ID="panel2" runat="server"> </asp:Panel>
<input type="button" onclick="test() " value="test" />
</div>
</form>
</body>
</html>
Hope this helps.
Sincerely,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support
=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.