开发者

Best UI strategy for adding related entities

I have three related entities:

  • a user has many device
  • a user has a userinfo

I have a process sell device that adds user, userinfo and device to the database. I want to implement this in asp.net pages with a minimum of postbacks and an easy to maintain strategy.

One obvious strategy is, first I insert user, and then postback to userinfo page with id of the just insert开发者_运维百科ed user, after that insert userinfo, and then postback to device page with id of user and finally insert device. This is easy but it involves three postbacks that I don't want.


The best way I can think of is by using the Master table object as the grid row and then handle the edit capability of the Master row and create EditTemplates for GridView to suit your scenario. Inside edit template, fill up all the related entities and Update/Save it. For minimum postback, you can wrap this grid inside AJAX (if UpdatePanel does the trick, no need to expose the Update/Save methods as JSON methods)

Hope I am straight to the point.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜