我有一个控制对象。在控制对象中,我添加了一个 Button 。我想处理 Button 对象的点击事件。
mapcomponent.MapObjectClick += new MapComponent.MapComponent.MapObjectEventHandler(mapcomponent_MapObjectClick);
Public void mapcomponent_MapObjectClick(object sender, MapObjectEventArg e)
{
if (e != null)
{
var obj = sender as Control;
var txt = obj.FindControl("txt1") as TextBox;
if (txt != null)
txt.Text = "hello";
var btn = obj.FindControl("btn1") as Button;
if (btn != null)
{
btn.Command += new CommandEventHandler(b_Command); //handler
}
}
}
//Not working
Public void b_Command(object sender, CommandEventArgs e)
{
//Want to call This Method
}