By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,214 Members | 2,038 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,214 IT Pros & Developers. It's quick & easy.

FormView, ObjectDataSource, Business object: can't customize some methods

P: n/a
Hello folks, I'll try to be as much clear as I can.

This is my issue: Asp.NET 2.0 page w/ FormView (later: FW), an
ObjectDataSource (ODS). It works with my Business logic layer, where I
have some methods to retrieve and set data. ODS works with this
MyObjectManager object. MyObjectManager has GetObjects that return an
ObjectsCollection and so on. Nothing special.

MyObject has 3 properties, for example: Color, Description, Size
(datatypes are ininfluents)

Additionally and obviously, MyObjectManager has to save data. Let's
talk about adding, updating doesn't matter for the moment. Building
the add method as

MyObjectManager.AddObject(o as MyObject)

works well. I don't really know why (not yet done my homeworks), but
it seems that ODS recognize the type of objects I bound and passes a
filled o as MyObject to the function; o is correctly filled with data
I type in my FV.

Note: at this stage, looking at aspx code, ODS hasn't any
InsertParameters specified. Even if the method specified in
InsertMethod needs an "o" parameter.

Good but not enough: I want to extend my MyObjectManager.AddObject to
accept an incoming Username string, to log something. Method becomes:

MyObjectManager.AddObject(o as MyObject, Username as String)

Of course, I build and update my ODS to the new signature. In the aspx
code something appears under IsertParameters: now there are 2
insertparameters, for the "o" and for the "username" AddObject's
parameters.

But when I run this, fill the FV data and push "Insert", it crashes,
saying that ObjectDataSource can't find a non-generic method that
accepts the parameters

o, Username, Color, Description, Size

Seems like it "sees" parameters within InsertParameters but also
queues the fields it founds bounded to the FV. Above all, seems that
it no longer recognize the fact that it has to pass a MyObject
instance. I can always pass not a custom object to my managers but a
list of parameters, but that would be a great thing with objects wit
lot of properties.

Any suggestion?

TIA,
teKa

Jun 6 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.