Custom Module not interacting with .ascx.cs file

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.
1/28/2011 2:27:44 PM
Gravatar
Total Posts 7

Custom Module not interacting with .ascx.cs file

I'm working on a module that will display videos to a user much like YouTube.  I have set up the module as follows:

mojoPortal.Features.Business
-Movies
--Movie.cs
--MovieList.cs

mojoPortal.Features.Data.MSSQL
-Movies
--DBMovies.cs

mojoPortal.Features.UI
-App_GlobalResources
--MoviesResources.resx
-Movies
--EditMovie.aspx
---EditMovie.aspx.cs
---EditMovie.aspx.designer.cs
--MoviesModule.ascx
---MoviesModule.ascx.cs
---MoviesModule.ascx.designer.cs
-Setup
--movies
---FeatureDefinitions
----1234_MoviesModule.config
---SchemaInstallScripts
----mssql
-----0.0.0.1.config

mojoPortal.Web
-App_GlobalResources
--MoviesResources.resx
-Movies
--MoviesModule.ascx
--EditMovie.aspx

My database has a table called mp_Movies and various procedures for manipulating data.  I have a sample row of data to try to display on the page.

My page displays the box for the movies module, which tells me that it can find the module and display the page from the MoviesModule.ascx, but when I try to display information on the box, nothing comes up.  I have two asp:Labels and I simply do the following in the MoviesModule.ascx.cs file:

scrollMovieList.Text = "HOWDY";
moviePlayer.Text = "HOWDY";

Neither of these boxes are saying HOWDY.  Note that in mojoPortal.Web/Movies, I only have the ascx and aspx, but not the ascx.cs and aspx.cs.

I noticed that a lot of other modules are the same way (missing the ascx.cs/aspx.cs) and they load just fine.  I tried looking through your documentation, but I wasn't able to find anything.  Which is not to say the information isn't there, since I didn't exhaust your documentation.

Any help would be extremely helpful!
 

1/29/2011 7:15:54 AM
Gravatar
Total Posts 18439

Re: Custom Module not interacting with .ascx.cs file

Hi,

I noticed that a lot of other modules are the same way (missing the ascx.cs/aspx.cs) and they load just fine.

That means you are not working with the mojoPortal Source code, you are using pre-compiled deployment files and all the .cs files are compiled into dlls in the /bin folder. We don't deploy C# source code to production, this article should help you:

http://www.mojoportal.com/understanding-the-difference-between-deployment-files-and-source-code.aspx

Hope it helps,

Joe

1/31/2011 8:42:59 AM
Gravatar
Total Posts 7

Re: Custom Module not interacting with .ascx.cs file

I am using the source code. If you look at the tree structure I made in the previous post, it shows which files I made and where I put them.  I guess my main problem is when I compile the code, the files in the Movies folder in the other namespaces aren't being copied over to Web.

1/31/2011 9:21:14 AM
Gravatar
Total Posts 18439

Re: Custom Module not interacting with .ascx.cs file

The folder structure you posted is for your own feature so I did not assume from that that you are using mojoPortal source code. One could still do that while using the pre-compiled mojoPortal files, but if you are sure you are using mojoPortal source code then I'll take your word for it

All the features in the source code includes code behind .cs files. Maybe you are looking at the ones that do get copied up to Web from other projects, the source code is not copied only the .ascx, .aspx files are copied and the .cs files are compiled into dll copied up to Web/bin but are not copied up to Web. So if you look under Web/Blog/BlogMudule.ascx you won't see any .cs file there but it exists in mojoPortal.Features.UI/Blog.

I see one problem in your folder structure if you posted it correctly then it is not setup correctly. Your movies folder should not be directly below /Setup, it should be under /Setup/applications/movies

In any case if your code is not working as expected you should set break points in your code in your project then rebuild your project then launch mojoPortal.Web project in the debugger and you can step through your code. If your code is not executing it could be that you do not have events wired up correctly in your code.

Hope it helps,

Joe

1/31/2011 9:30:58 AM
Gravatar
Total Posts 7

Re: Custom Module not interacting with .ascx.cs file

Oops, I actually had the setup folder set up correctly, I just didn't write it above correctly.  But the problem still remains, when I do a fresh setup, the Movies folder doesn't get copied at all.  And all the code right now in the MoviesModule.ascx.cs file is this:

using mojoPortal.Web;
...

namespace mojoPortal.Web.MoviesUI
{
     public partial class Movies : SiteModuleControl
     {
          protected void Page_Load(object sender, EventArgs e)
          {
              scrollMovieList.Text = "HOWDY";
          }
     }
}

I also don't get anything in the system logs

1/31/2011 9:41:25 AM
Gravatar
Total Posts 18439

Re: Custom Module not interacting with .ascx.cs file

There is no automagic copying of files, you have to make that happen in the post build event of your UI feature so it happens whenever you rebuild your feature. Right click your UI project and choose properties, then click the build events tab and you will see where you can edit post build event.

Study the post build event in mojoPortal.Features.UI or WebStore.UI to learn how to write your own post build event to copy files.

Hope it helps,

Joe

1/31/2011 9:57:11 AM
Gravatar
Total Posts 7

Re: Custom Module not interacting with .ascx.cs file

That did the trick! I didn't even notice the build events. Thanks so much for your help!

1/31/2011 12:26:27 PM
Gravatar
Total Posts 18439

Re: Custom Module not interacting with .ascx.cs file

Glad you got it working!

And many thanks for the beer! Much appreciated.

Cheers,

Joe

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