Web Part, MasterPages and Personalization

Last post 08-30-2005 2:51 AM by bwt. 3 replies.

Sort Posts:

  • Web Part, MasterPages and Personalization

    08-29-2005, 4:57 AM
    • Loading...
    • bwt
    • Joined on 03-10-2004, 10:55 PM
    • Posts 4

    I am trying to use web part as my left panel menu. My menu consists of modules like "Organization", "System Setting", etc at the left hand side in the MasterPages.Within "Organization" there are submenus that contains link to different pages. Each module will take up one web part that allows the user to drag the rearrange once he/she has login. I noticed however that once the user rearrange the web part, it only applies to the particular aspx page. Can someone advice me on how to make it apply to all aspx pages for the same user?

  • Re: Web Part, MasterPages and Personalization

    08-30-2005, 2:51 AM
    • Loading...
    • bwt
    • Joined on 03-10-2004, 10:55 PM
    • Posts 4

    Don't know if I had put my question clearly of my post. Basicall, my intention is to simulate the the window environment where I allow the user to rearrange the menu item according to their preference - just like the icon for the windows that user can arrange to according to their preference. It seems to me however that this is not quite achievable when I put the web part in the masterpages, as the personalization uses URL of the content page as the personization key. I could use one aspx page like "default.aspx" and populate the content with dynamic user control accordingly when user clicks on certain link, but this defeats the purpose of using MasterPages in the first place. I would appreciate any kind of advice, pointers or workaround. Thanks!

  • Re: Web Part, MasterPages and Personalization

    09-02-2005, 4:18 AM
    • Loading...
    • bwt
    • Joined on 03-10-2004, 10:55 PM
    • Posts 4

    I have finally resolved this issue. Basicall, I need to overwrite "System.Web.UI.WebControls.WebParts.SqlPersonalizationProvider" class with my own custom class. I simply need to do some tricks when I get or set path. I now can put web part in the master pages, drag, minimize, etc and when I navigate to a different page, the same display will be shown. I have included the code here and hope this can be helpful for others who might need it. You just need to ensure the web.config is pointing to this custom class for personalization.

    Web.Config:
    <webParts>

    <personalization defaultProvider="SqlProvider">

    <providers>

    <clear/>

    <add name="SqlProvider" type="CustomSqlPersonalizationProvider" connectionStringName="ConnectionString"/>

    </providers>

    </personalization>

    </webParts>

    Custom SqlPersonalization:
    public
    class CustomSqlPersonalizationProvider : SqlPersonalizationProvider

    {

    private string GetPath

    {

    get

    {

    return "default.aspx";

    }

    }

    protected override void LoadPersonalizationBlobs(WebPartManager webPartManager, string path, string userName, ref byte[] sharedDataBlob, ref byte[] userDataBlob)

    {

    base.LoadPersonalizationBlobs(webPartManager, this.GetPath, userName, ref sharedDataBlob, ref userDataBlob);

    }

    protected override void SavePersonalizationBlob(WebPartManager webPartManager, string path, string userName, byte[] dataBlob)

    {

    base.SavePersonalizationBlob(webPartManager, this.GetPath, userName, dataBlob);

    }

    protected override void ResetPersonalizationBlob(WebPartManager webPartManager, string path, string userName)

    {

    base.ResetPersonalizationBlob(webPartManager, this.GetPath, userName);

    }

    }

  • Smile [:)] Re: Web Part, MasterPages and Personalization

    09-02-2005, 4:19 AM
    • Loading...
    • bwt
    • Joined on 03-10-2004, 10:55 PM
    • Posts 4

    I have finally resolved this issue. Basicall, I need to overwrite "System.Web.UI.WebControls.WebParts.SqlPersonalizationProvider" class with my own custom class. I simply need to do some tricks when I get or set path. I now can put web part in the master pages, drag, minimize, etc and when I navigate to a different page, the same display will be shown. I have included the code here and hope this can be helpful for others who might need it. You just need to ensure the web.config is pointing to this custom class for personalization.

    Web.Config:
    <webParts>

    <personalization defaultProvider="SqlProvider">

    <providers>

    <clear/>

    <add name="SqlProvider" type="CustomSqlPersonalizationProvider" connectionStringName="ConnectionString"/>

    </providers>

    </personalization>

    </webParts>

    Custom SqlPersonalization:
    public
    class CustomSqlPersonalizationProvider : SqlPersonalizationProvider

    {

    private string GetPath

    {

    get

    {

    return "default.aspx";

    }

    }

    protected override void LoadPersonalizationBlobs(WebPartManager webPartManager, string path, string userName, ref byte[] sharedDataBlob, ref byte[] userDataBlob)

    {

    base.LoadPersonalizationBlobs(webPartManager, this.GetPath, userName, ref sharedDataBlob, ref userDataBlob);

    }

    protected override void SavePersonalizationBlob(WebPartManager webPartManager, string path, string userName, byte[] dataBlob)

    {

    base.SavePersonalizationBlob(webPartManager, this.GetPath, userName, dataBlob);

    }

    protected override void ResetPersonalizationBlob(WebPartManager webPartManager, string path, string userName)

    {

    base.ResetPersonalizationBlob(webPartManager, this.GetPath, userName);

    }

    }

Page 1 of 1 (4 items)
Microsoft Communities
Page view counter