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.
}
}
精彩评论