问题描述
我有一个母版页.然后我有几个内容页面,可以说我现在有2个内容页面cp1和cp2.
每个内容页面都有一个表单,该表单将具有一些用户输入,并具有一个SaveData()
函数,该函数将数据保存到数据库中.
我想在母版页上保留一个通用的保存按钮.当打开cp1时,如果单击保存"按钮,则将保存cp1输入数据.
当打开cp2时,如果单击保存"按钮,则会保存cp2输入数据.
对于此解决方案,请在内容页面中使用以下代码,
I have a master page. Then i have several content pages, Lets say I have 2 content pages for now cp1 and cp2.
Each content page has a form that will have some user input and a SaveData()
function that saves the data to a database.
I want to keep a common save button in the master page. when cp1 is opened if i click the save button then cp1 input data is saved.
when cp2 is opened if i click the save button then cp2 input data is saved.
for this solution is use the following code in content page,
Button btn = this.Master.FindControl("btnSave") as Button;
btn.Click +=new System.EventHandler(SaveData1);
然后我发现了一个错误:
No overload for SaveData1 matches delegate System.EventHandler
Then i found a error:
No overload for SaveData1 matches delegate System.EventHandler
How can i solve it??
推荐答案
void SaveData1(object sender, EventArgs e)
{
//Code to process your request
}
public delegate void EventHandler(Object sender, EventArgs e);
public event EventHandler NoDataEventHandler;
谢谢
Thanks
这篇关于当我在母版页中使用通用保存按钮时发现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!