Click here to Skip to main content
15,898,134 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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);


Then i found a error:
No overload for SaveData1 matches delegate System.EventHandler

How can i solve it??
Posted
Updated 28-Dec-10 22:42pm
v2

The SaveData1 has the format as below:

C#
void SaveData1(object sender, EventArgs e)
        {
            //Code to process your request
        }
 
Share this answer
 
What are the arguments are in SaveData1 method. It must be

object sender and EventArgs e like

SaveData1(object sender, EventArgs e)
 
Share this answer
 
Hi
From the MSDN

http://msdn.microsoft.com/en-us/library/system.eventhandler.aspx[^]

System.EventHandler delegate looks like this..

C#
public delegate void EventHandler(Object sender, EventArgs e);
public event EventHandler NoDataEventHandler;


Thanks
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900