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.
这是我的问题。
string btn = "btn7"; //this is the problem. btnClone.click += this.controles[btn]_click ;
所以我喜欢使用字符串将事件共享给另一个按钮,并且字符串是必须的。
我希望有人能帮助我。
通过 id 查找控件的更标准方法是
Button b = (Button)FindControl(btn);
不知道id也可以这样搜索
Button oldButt = this.Controls.OfType<Button>().(b => b.Name == btn).First();