No overload error???

G

Gary Wardell

HI,

I'm getting this error:

No overload for 'DoItemUpdated' matches delegate
'System.Web.UI.WebControls.DetailsViewUpdatedEventHandler'

on line=22

Line 22 reads:

<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="false"
style="top: 25px; left: 15px; position: absolute; width: 622px"
DataSourceID="SqlDataSource3"
AutoGenerateEditButton="true"
AutoGenerateDeleteButton="true"
AutoGenerateInsertButton="true"
OnItemUpdated="DoItemUpdated"
The function in the code behind reads:

protected virtual void DoItemUpdated(DetailsViewUpdatedEventArgs Args)
{
lblMsg.Text = " Record " + Args.Keys["BookID"] + " updated";
}

Since I am a bit new to ASP.net and C# I'm at a loss as to what it's trying
to tell me?

Is it saying it can't find the function?

Is it saying that the definition of the function doesn't match what is
expected?

I've tried different definitions, the message doesn't change.

It can find the Page_Load function in the same file which has a similar
definition.

Gary
 
M

Mark Fitzpatrick

You're missing a parameter in the event. Most events also take a parameter
called sender, which is basically just a generic object that represents the
object firing the event.


Try doing this:
protected void DoItemUpdated(object sender, DetailsViewUpdatedEventArgs
Args)
{

}

hope this helps,
Mark Fitzpatrick
Microsoft MVP- Expression

Gary Wardell said:
HI,

I'm getting this error:

No overload for 'DoItemUpdated' matches delegate
'System.Web.UI.WebControls.DetailsViewUpdatedEventHandler'

on line=22

Line 22 reads:

<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="false"
style="top: 25px; left: 15px; position: absolute; width: 622px"
DataSourceID="SqlDataSource3"
AutoGenerateEditButton="true"
AutoGenerateDeleteButton="true"
AutoGenerateInsertButton="true"
OnItemUpdated="DoItemUpdated"
The function in the code behind reads:

protected virtual void DoItemUpdated(DetailsViewUpdatedEventArgs Args)
{
lblMsg.Text = " Record " + Args.Keys["BookID"] + " updated";
}

Since I am a bit new to ASP.net and C# I'm at a loss as to what it's
trying
to tell me?

Is it saying it can't find the function?

Is it saying that the definition of the function doesn't match what is
expected?

I've tried different definitions, the message doesn't change.

It can find the Page_Load function in the same file which has a similar
definition.

Gary
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top