problem updating custom settings on my account/profile menu

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/3/2011 7:18:03 AM
Gravatar
Total Posts 19

problem updating custom settings on my account/profile menu

Happy new year to mojoportal community. I have a strange problem and after hours of searching I decided to ask your opinion about it. I have one month experience with ASP.NET but luckily i managed to make a working module for this CMS. So, I suspect my problem is more of an ASP.NET issue.

I have added some custom settings on account/profile menu (UserProfile.aspx). I made a Data and a Business class for this equivalent to dbSiteUser and SiteUser (i did not want to mess with SiteUser for easiest possible upgrading purpose.). Everything works ok till the time i press the Update button. For some reason the update functions have no effect on database when they are called in the update button click handler. When i call them anywhere else in the code-behind they work fine without problems ( that is the most worrying part for me). I tried many many things for many hours.

Here is the function with "perfectly" working functions (i do not use these fixed values,i just wrote it like this to look for the problem):

    private void UpdateProfileExtension() {
    profext.Option = 3;
    profext.ShowFriends(); // updates field "ShowFriends" to option( = 3)
    profext.Option = 2;
    profext.ShowStats();// updates field "ShowStats" to option( = 2)
    profext.Option = 1;
    profext.ShowActs();// updates field "ShowActs" to option( = 1)
    }


Here is where it is called:

    private void btnUpdate_Click(Object sender, EventArgs e)
    {
        if (siteUser != null)
       {
         Page.Validate("profile");
         if (Page.IsValid)
        {
           UpdateProfileExtension(); // i have tried copy pasting everything into UpdateUser(). no use.
           UpdateUser();
        }
      }

    }

I give you the functions from data and business part too for one of the functions (all 3 work similarly).

    public bool ShowFriends()
    {
    return DBProfileExtension.SetShowFriends(this.userID,this.option);
    }

    public static bool SetShowFriends(int UserID, int Option)
    {
    SqlParameterHelper sph = new SqlParameterHelper(GetConnectionString(), "ext_UsageStatsShowFriends", 2);
    sph.DefineSqlParameter("@UserID", SqlDbType.Int, ParameterDirection.Input, UserID);
    sph.DefineSqlParameter("@Option", SqlDbType.Int, ParameterDirection.Input, Option);
    int rowsAffected = sph.ExecuteNonQuery();
    return (rowsAffected > -1);
    }


I am about to give up on this one but I asked in case i come across this problem again in a more important function of my project. Thanks in advance and best wishes to everyone.

1/5/2011 11:44:58 AM
Gravatar
Total Posts 19

Re: problem updating custom settings on my account/profile menu

Is it so obvious that no one bothers to answer? I suspect that it has something to do with validation controls. I even tried with the button not having the validation group tag, though. Still nothing. Any help is really appreciated. Thanks again.

1/5/2011 11:55:22 AM
Gravatar
Total Posts 18439

Re: problem updating custom settings on my account/profile menu

Hi,

You need to set break points in your code and step through it with the debugger to find out what is happening or not happening and why.

Hope it helps,

Joe

1/5/2011 12:31:43 PM
Gravatar
Total Posts 19

Re: problem updating custom settings on my account/profile menu

Happy new year mr.Audette.  Firstly, i would like to thank you about this CMS. I have a big project on ASP.NET and mojoportal really saved the day. Easy to learn and use, yet powerful. It was the right choice.

I will revisit this problem and i will post here if i manage to find what the problem was. I thought it was something obvious that i failed to trace since i am new to this kind of development. Thanks for your time.

1/12/2011 4:28:43 AM
Gravatar
Total Posts 19

Re: problem updating custom settings on my account/profile menu

Hello. I just wanted to post what happened. I went today to use this extension i wrote as I moved the application to IIS (I had "The HTTP verb POST used to access path '/' is not allowed." on visual studio web server. This post helped me http://www.mojoportal.com/Forums/Thread.aspx?pageid=5&mid=34&ItemID=2&thread=4267&pagenumber=1 I bumped into it as i googled the error. I would propose including it somewhere in documentation if it is not already there.).

It magically worked on both servers (IIS , vs web server) without any issues. I cannot explain how did this happen since i did not do anything. The only thing that changed is some extra disk space. Or maybe it was some browser cache issue (although i used 2 browsers at that time). So it was either a perfomance or a browser caching problem.

Thanks again.

1/12/2011 7:16:31 AM
Gravatar
Total Posts 18439

Re: problem updating custom settings on my account/profile menu

Hi,

I've just update the developer faq page with information about this

http://www.mojoportal.com/developer-faq.aspx

Best,

Joe

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