asp.net中的按钮自动刷新页面。在调用按钮事件之前,调用默认的Page_Load函数(我认为)。按钮事件后运行功能
我正在寻找调用所有按钮事件后调用函数的方法。
编辑
我要永远调用的函数,即使没有按钮被按下。所以把这个函数放在按钮事件中是行不通的。
创建按钮
ImageButton enc2Button = Hardwarerecorders.DeviceManager.getEncStatusImage(d, "res/", false);
这是click事件
enc2Button.Click += new ImageClickEventHandler(startEnc2);
按钮事件功能
void startEnc2(object sender, EventArgs e)
{
ImageButton button = (ImageButton)sender;
int arrayIndex = Int32.Parse(button.Attributes["index"]);
Hardwarerecorders.DeviceManager.startEnc((Hardwarerecorders.Device)devices[arrayIndex], false);
}
如果您未添加一些代码并提高此帖子的质量,则很难为您提供帮助 – acostela
您是否在谈论javascript功能?或者后面的代码? –
@PiyushKhatri我正在谈论一个C#函数 –