开发者

asp.net web forms constructor?

I want to load a dictionary w开发者_如何学运维ith some data and use it in the button event handler of a web form. Where is the appropriate place to put this code? There is a Page_Load method, but I don't want it to run every time the page loads.


in a Page Load event handler, call the method only once when the page first loads.

protected void Page_Load(object sender, EventArgs e)
{
    if(!IsPostBack)
    { 
        // your code to load dictionary here, or a method call.
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜