Getting ModuleGuid in a UserControl

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
6/3/2009 2:32:17 PM
Gravatar
Total Posts 18439

Re: Getting ModuleGuid in a UserControl

Hi Rick,

I don't have any problem with adding that setter as it is similar to the one for moduleid, I will add it, but I think the implementation of your own feature is problematic and I would advise against it. The problem is you are databinding a grid and in the itemdatabound event of each row you are making another call to the db by using this constructor on module which is not a good idea at all and won't scale well. 

Its fine to use UserControls but SiteModule is a special UserControl designed for a much different purpose than what you are doing. 

Best,

Joe 

6/3/2009 2:32:57 PM
Gravatar
Total Posts 18439

Re: Getting ModuleGuid in a UserControl

Oh, and Many Thanks for the beers! 

Cheers,

Joe

6/3/2009 2:50:59 PM
Gravatar
Total Posts 245
mojoPortal Community Expert

Re: Getting ModuleGuid in a UserControl

Hi Joe

Thanks for the advice.  I can see the performance issue when I run this through debug.  On a going forward basis I'll not use SiteModule for my custom user controls.  however...  I'm going to leave in this quick fix till I get time to fix it up.  I've got to demo this feature to my manager tomorrow AM and time is running out.

Thanks

6/3/2009 9:21:37 PM
Gravatar
Total Posts 245
mojoPortal Community Expert

Re: Getting ModuleGuid in a UserControl

Hi Joe

As you recommended, I removed SiteModule inheritance from all my user controls except the feature entry one.  All I really needed was the new ModuleGuid set you are going to do for me in the next build.

This issue was certainly a good mojoPortal code learning experience for me.  After this I like mojoPortal more than ever.

Cheers... enjoy the beer.  I'm having one right now!

Rick

6/4/2009 5:53:29 AM
Gravatar
Total Posts 18439

Re: Getting ModuleGuid in a UserControl

Hi Rick,

I would broaden my advice to don't use any UserControl in a grid if that UserControl makes any database hits. It basically an architectural and performance anti pattern. I mean it can be ok like inside an EditItemTemplate of an editable grid but not an ItemTemplate, because when editing its just the active row where the extra db access will occur. Its particularly bad if the grid is binding to an IDataReader because it has an open connection with the db while it databinds and if more things are making data requests you are using multiple connections at once.

You should generally design it so that all the data needed by the grid is in the result set. If its a situation where you need a master/detail kind of grid you can create a DataSet with multiple data tables in it connected by datarelations. One place in mojoportal code where you can see an example of constructing such a DataSet is in the WebStore.Business project in the Store.cs line 565 GetProductPageWithOffers.

I would not use a Grid to layout feature rich controls that do internal data access.

Hope it helps,

Joe

 

 

You must sign in to post in the forums. This thread is closed to new posts.