开发者

How to fire the ObjectDataSource's Inserting event programmatically (as opposed to DataBound Control)

I have a wizard control that collects data over 7 steps. There's a ObjectDataSource at the 7th step. When the user clicks the finish button, I want the ObjectDataSource Control to fire its Inserting event so that data can be passed to the underline method and eventualy be saved to the database.

How do I do that?

<asp:ObjectDataSource ID="UploadPhotoObjectDataSource" runat="server"
 DataObjectTypeName = "PhotoData" TypeName = "ImagesBLL.cs" 
 InsertMethod = "AddImage">

</asp:ObjectDataSource&g开发者_开发技巧t;

Thanks for helping


I don't think you can according to this thread:

Why events can't be used in the same way in derived classes as in the base class in C#?

Triggering the Inserting event instead of doing an actual insert is a step you may wish to reconsider. Calling Insert will trigger then Inserting event (and after the data is inserted, the Inserted event).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜