Hello,
I've been trying to access the html element "Body" in my server side
code. I've searched the archives of this group and have been able to
put together an example that doesn't work :)
Actually, I am want to raise an event at client side and want to
perform some action on the server side when that event at client is
triggered. So here is what I am trying to do,
<%@ Page Language="C#" AutoEventWireup ="true"
CodeFile="Defau lt.aspx.cs" Inherits="__Def ault"%>
<html>
<head>
</head>
<body runat="server" id="mybody">
<form id="form1" action="Default .aspx" runat="server" method="post">
</form>
</html>
---
Now in my code behind file, I wrote
public partial class __Default : System.Web.UI.P age
{
void Page_Load(objec t sender, EventArgs e)
{
HtmlGenericCont rol mybody = new HTMLGenericCont rol();
mybody.Attribut es.Add("onload" ,"javascript:al ert(' hello !
');");
}
}
But nothing seems to be working , page loads and alert message doesn't
show up. What I am missing here?
Any help will be highly appreciated.
--Oltmans
P.S --I am working on ASP.NET 2.0