Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

telerik -- supercharge your DNN websites
  Ads  
 


  Sponsors  

Meet Our Sponsors

eUKhost.com is commited to offer exceptional UK Windows Web Hosting solutions with quality 24x7 technical support.Our plans support ASP.Net, ASP, ASP.NET Ajax extensions, XML, MSSQL, MySQL, PHP,DNN, multiple domains and Shared SSL as standard.
SmarterTools
Verndale
The Official Microsoft ASP.NET Website
Portal Webhosting - Hosting For Developers
Red-Gate Software
 


DotNetNuke Forums
 
  Forum  General DotNetN...  Extend It! ( Pr...  Can I get immediate updates on SetProfileProperty functions?
Previous Previous
 
Next Next
New Post 8/12/2008 12:14 PM
Resolved
User is offline mikedev279
3 posts
10th Ranked


Can I get immediate updates on SetProfileProperty functions? 

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 7:59 AM
User is offline Mitch Sellers
5712 posts
www.mitchelsellers.com
3rd Ranked




Re: Can I get immediate updates on SetProfileProperty functions? 

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
MCITP, MCPD, MCTS
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 Consulting Quotes, and DNN Technical Support Services

I reccomend 3Essentials for shared hosting and BaseCamp for project management
 
New Post 8/13/2008 8:23 AM
User is offline mikedev279
3 posts
10th Ranked


Re: Can I get immediate updates on SetProfileProperty functions? 

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 8:48 AM
Accepted Answer 
User is offline Mitch Sellers
5712 posts
www.mitchelsellers.com
3rd Ranked




Re: Can I get immediate updates on SetProfileProperty functions? 

Ensure that the cache value is set to 0!


-Mitchel Sellers
MCITP, MCPD, MCTS
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 Consulting Quotes, and DNN Technical Support Services

I reccomend 3Essentials for shared hosting and BaseCamp for project management
 
New Post 8/13/2008 9:15 AM
User is offline mikedev279
3 posts
10th Ranked


Re: Can I get immediate updates on SetProfileProperty functions? 

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 Previous
 
Next Next
  Forum  General DotNetN...  Extend It! ( Pr...  Can I get immediate updates on SetProfileProperty functions?
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, 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 DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


DNN SEO
Seablick Consulting specializes in DNN search engine optimization (SEO), DNN consulting, as well as support & training.
seablick.com
Intura Vision / Intura Enterprise
Point-of-Sale and business management applications targeted towards quick service, fast casual and delivery-based restaurant concepts.
www.intura.com
Dnaxp.Net
Dnaxp.Net offers a comprehensive base of information, resources, and support for DotNetNuke.
www.dnaxp.net

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP