c# - Can button click event handler be invoked before Page_Load? -
i have following code has page load event handler , button click event handler. page load handler invoked before button click expected in page life cycle.
is there scenario in button click handler called prior page load handler ? (due validation control or so).
if guaranteed page_load
called always, need not call mygetcount()
function inside button click handler.
public partial class webform1 : system.web.ui.page { int tabledatacount = 0; protected void page_load(object sender, eventargs e) { string val = system.security.principal.windowsidentity.getcurrent().name; //get count inside page load tabledatacount = mygetcount(); } protected void btnaction_click(object sender, eventargs e) { response.write(tabledatacount.tostring()); } private int mygetcount() { int count = 135; //logic count return count; } }
there no scenario button click handler called before page-load , not possible also. in page load controls initialized event handlers controls can invoked.
Comments
Post a Comment