AutoEventWireup=”true” 시
When the page posts back, the Page_Load method is called. Then, once the server actually processes the page and sends you a new one based on changes, the Page_Load is called again, actually the first time on the new page sent to you.
So if you are pulling data in the Page_Load event or setting some values, enclose it in the following block:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["something"] == null) { Session["something"] = "1"; } else { Session["something"] = null; //your page load code here } } } |
참조 : http://stackoverflow.com/questions/1094954/asp-net-page-load-being-called-multiple-times