Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在运行时从我的服务器端代码添加多个 div。
mainSubjectDiv.Controls.Add(headerDiv);
现在我想处理服务器端的点击事件。这个怎么做?
您可以使用常规 .NET 事件语法将事件添加到代码中的控件:
headerDiv.Click += new EventHandler(headerDiv_Click); public void headerDiv_Click(object sender, EventArgs e) { .................//Your code will be here }