Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Can I get immediate updates on SetProfileProperty functions?Can I get immediate updates on SetProfileProperty functions?
Previous
 
Next
New Post
8/12/2008 2:14 PM
 

Hello All,

[My first DNN post!]

I just started looking into Module development with DNN and right away I'm looking into utilizing some features of the DNN framework. My first target is to be able to keep track of the user's current session setting in one module, and be able to access that setting value in other modules. Mainly I just need a single string value.

For example, there's a module at the top of each page where they select their current Location. I want the DropDownList in this module to trigger setting some user-based global "Current Location" setting so that other modules can react to this setting and display different values.

I think I'm using version 4.8.4, and I'm developing using MS Visual Web Developer 2008 Express, and although I've programmed Windows apps in Delphi a lot I don't have any experience writing web applications.

I took the most basic module that doesn't really do anything (Marketplace module) and added a label and a dropdownlist.

Protected Sub ListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.TextChanged
            Dim objUser As UserInfo = UserController.GetCurrentUserInfo()
            objUser.Profile.SetProfileProperty("CurrentLoc", ListBox1.Text)
            ProfileController.UpdateUserProfile(objUser)

I have the AutoPostBack set to True on the drop down list.

then in Page_Load

Dim objUser As UserInfo = UserController.GetCurrentUserInfo()
Label1.Text = Entities.Users.UserController.GetCurrentUserInfo.Username.ToUpper + " Current: " + objUser.Profile.GetPropertyValue("CurrentLoc") + " Select New: "

When I select the item in my drop down list and the post back occurs, the profile property is not there.

So how can I have something that's updated immediately, to this module and any module on any page the user goes to?

NOTE: I've also tried functions like DotNetNuke.Services.Personalization.Personalization.GetProfile and DotNetNuke.Services.Personalization.Personalization.SetProfile but it seems to have the same effect.

 

Thanks all in advance,

mikdev279

 

 

 
New Post
8/13/2008 9:59 AM
 

The key to this is to understand the order in which events are triggered.  Page_Load occurs BEFORE the processing of any event methods. 

Therefore the update will not occur to the UI with the steps you have indicated.  You will need to update the label inside the ListBox1_SelectedIndexChanged event as well as page load.


-Mitchel Sellers
Microsoft MVP, ASPInsider, DNN MVP
CEO/Director of Development - IowaComputerGurus Inc.
LinkedIn Profile

Visit mitchelsellers.com for my mostly DNN Blog and support forum.

Visit IowaComputerGurus.com for free DNN Modules, DNN Performance Tips, DNN Consulting Quotes, and DNN Technical Support Services
 
New Post
8/13/2008 10:23 AM
 

Mitch,

Thanks for the reply, but I still think based on my understanding, that it's not working properly.

I have since changed my code to have a LinkButton that triggers the setting of the profile

 

Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButton1.Click

    DotNetNuke.Services.Personalization.Personalization.SetProfile("MyApp", "CurrentLoc", ListBox1.SelectedItem.Text)
    Label1.Text = "Current Location =" + DotNetNuke.Services.Personalization.Personalization.GetProfile("MyApp", "CurrentLoc") + " Select New: "

End Sub

 

After clicking this, moving to another page, and then coming back,.. in my page_load code

Label1.Text = "Current Location =" + DotNetNuke.Services.Personalization.Personalization.GetProfile("MyApp", "CurrentLoc") + " Select New: "

Is the exact same thing. My thought was that if I update the profile here, and then navigate away and come back, the Profile information would be maintained. This seems to work brilliantly in the Survey module I tried out as a tutorial. If I put in my survey - even coming back the next day it displays correctly right away. It seems instantaneous in its saving of the profile info.

Thanks!

Mike

PS: Although looking at it now I guess I also need to make sure I'm using ListBox1 right.

PPS: OK now when I change my code in Visual Web Dev Express, and rebuild that module page, it seems to work perfectly only in Edit mode for my Administrative user. But in view mode and for any other user, the module doesn't work. For my development learning I'm modifying DesktopModules\MarketShare\View.ascx and View.ascx.vb. I really think this is right but now it's just confusing to me. I think it's time for me to look at debugging and development strategies for DNN using Web Dev Express, but I still don't get why the Survey component works and mine doesn't.

 
New Post
8/13/2008 10:48 AM
Accepted Answer 

Ensure that the cache value is set to 0!


-Mitchel Sellers
Microsoft MVP, ASPInsider, DNN MVP
CEO/Director of Development - IowaComputerGurus Inc.
LinkedIn Profile

Visit mitchelsellers.com for my mostly DNN Blog and support forum.

Visit IowaComputerGurus.com for free DNN Modules, DNN Performance Tips, DNN Consulting Quotes, and DNN Technical Support Services
 
New Post
8/13/2008 11:15 AM
 

Mitch,

Brilliant! I will definitely pay more attention and to every single one of these options and read more before I jump into coding from here on out. This is exactly what I need is a zero-cache, completely dynamic site. I've got to get out of my Windows-development mind set.

I have a lot of reading to do!

Thanks a lot for your help!

-Mike

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Can I get immediate updates on SetProfileProperty functions?Can I get immediate updates on SetProfileProperty functions?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out