Home All Groups Group Topic Archive Search About

How to write a server events for 'Document' object of a ASP.NET page?

Author
14 Jan 2006 3:00 AM
ABC
If there have a page which have unknown '<div>' label or may be no any
controls.  I want add 'onclick' events to call server event to do something.
But there are no any events of 'Document' object on properties windows under
VS IDE.  How should I to do?

Author
14 Jan 2006 3:54 AM
Lau Lei Cheong
<div id="div_1" onclick="div_clicked();"> <input type="hidden"
id="hid_clickedctlname" runat="server">

include a javascript block...
<script language="javascript">
    function div_clicked() {
        document.getElementById("hid_clickedctlname").value = "div_1";
        form.submit();
    }
</script>

Now on the codebehind, you can check this.IsPostBack and the
hid_clickedctlname.Value to see if the div is clicked...

Show quoteHide quote
"ABC" <a**@abc.com> ¼¶¼g©ó¶l¥ó·s»D:eCXxAbLGGHA.3***@TK2MSFTNGP10.phx.gbl...
> If there have a page which have unknown '<div>' label or may be no any
> controls.  I want add 'onclick' events to call server event to do
> something. But there are no any events of 'Document' object on properties
> windows under VS IDE.  How should I to do?
>

Bookmark and Share