asp.net - intercept __doPostBack function -


according post can intercept post overriding function __dopostback wont work. if view generated source not able see function meant auto generated , causes asp.net make postback.

where function? , how intercept it?

i'm using asp.net 4 , vs 2012

default.aspx

<%@ page language="vb" autoeventwireup="false" codefile="default.aspx.vb" inherits="_default" %>  <!doctype html>  <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">     <title></title>      <script>         //breaks here cant find __dopostback         var __original = __dopostback;         __dopostback = myfunction();          function myfunction() {              alert('intercept');          }      </script>  </head> <body>     <form id="form1" runat="server">     <div>         <asp:textbox id="textbox1" runat="server" ></asp:textbox>          <asp:button id="button1" runat="server" text="button" />     </div>     </form> </body> </html> 

default.aspx.vb

partial class _default     inherits system.web.ui.page      protected sub form1_load(sender object, e eventargs) handles form1.load      end sub      protected sub button1_click(sender object, e eventargs) handles button1.click         dim txt string = textbox1.text      end sub end class 

an asp.net button renders <input type="submit" /> postback form, , never use method. __dopostback method used elements not input buttons not cause post operation server. function that's inside 1 of microsoft's javascript file, , gets rendered out on client. common uses __dopostback linkbutton controls, controls may have autopostback="true", , others.

also, there may call webforms_dopostback... named that posts back, internally calls __dopostback.

if trying prevent postback on click of button, attach submit event of form, , cancel postback operation way.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -