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

  • Thread starter Thread starter ABC
  • Start date Start date
A

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?
 
<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...
 
Back
Top