开发者

ASP.NET options/command generator framework?

I want to put context-sensitive, dynamic command options on my asp.net pages.

I tried coding my own command structure but it's not very good, and I'm sure there must be a framework for doing this somewhere I can re-use?

Example: I have a detailsview for some database object, I want to code in the object class what commands are available, based on the state of the object. I then want a UI object I can place on the webform that w开发者_如何学Pythonill pass commands back to the object when user clicks them, or jump to a different link (e.g. when additional parameters are available).

e.g. form might look like this


Product Details

Name: XXXX product

Price: $1.00

Qty: 1

Commands:

> Edit

> New Stock

> Mark as obsolete


So the commands at the bottom would have very little UI code and pass actions back to the object. For example the New Stock command would jump to a new page to ask for a quantity.


I don't know of the framework, but you could create something yourself. Let's say you are using MVP pattern, and assuming that this is a CRUD application, you could tell each view what type of object it is related to, then annotate you object with operations that are available. Then Presenter could call Service to perform the operation. You could name your methods using some convention so that you can wire it up in a Service. It is a lot of work, and unless you have 100s of views it is not worth while. I am building app that is about that size, and I am in process of creating GenericMVP framework, that would make wiring a breeze.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜