Trying to redirect in ObjectDataSource OnUpdated EventHandler
When I use OnUpdated in my ObjectDataSource I get
No overload for 'OnUpdated' matches delegate >'System.Web.UI.WebControls.ObjectDataSourceStatusEventHandler'
I find nothing on web to help even though I find OnUpdated in Declaritive Syntax at http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.objectdatasource.aspx
I just want to redirect when form is updated.
<asp:ObjectDataSource ID="ObjectData开发者_运维问答Source1" runat="server"
DataObjectTypeName="ProfileWrapper" SelectMethod="GetData"
TypeName="ProfileDataSource" UpdateMethod="UpdateData"
OnUpdated="Redirect_OnUpdated">
protected virtual void Redirect_OnUpdated(object source, ObjectDataSourceMethodEventArgs e)
{
Response.Redirect("ShoppingCart.aspx");
}
From MSDN:
Handle the Updated event to examine the values of a return value or output parameters, or to determine whether an exception was thrown after an Update operation has completed. The return value, output parameters, and exception handling properties are available from the ObjectDataSourceStatusEventArgs object that is associated with the event.
Your method signature is wrong: you used ObjectDataSourceMethodEventArgs.
精彩评论