CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.web_parts_and_personalization Tags:
Item Type: NewsGroup Date Entered: 4/27/2006 3:13:28 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 11 Views: 17 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
12 Items, 1 Pages 1 |< << Go >> >|
ilegare76
Asp.Net User
How to access asp_personalizationPerUser ?4/27/2006 3:13:28 PM

0/0

Hello,

I work on a project where people can add personnalized content to their "MyPage".  I don't use the catalogPart and I programmatically add the webpart controls to the page.

My own catalog is organized by roles so the user can only add webpart related to his roles (user can have multiple roles).

My problem is : on the user login, I synchronize roles with an external database.  If a user loses one role, how can I remove webparts related to this role on his "MyPage".  I need to know all webparts on his "MyPage" and remove (programmatically) theses webparts...

So :
1 - how to know all user webParts (read aspnet_personalizationPerUser)
2 - how to remove programmatically a webpart identified previously by the table aspnet_personalizationPerUser)

Thanks you very much, I'm very desperate ;-)

Iannick
P.S. Sorry for my "medium" english !

ilegare76
Asp.Net User
Re: How to access asp_personalizationPerUser ?5/1/2006 8:10:22 PM

0/0

Hi, still me..
First of all, here how to transform a user control to webpart and add it dynamically to the user "MY" Page.

Dim
controlRSS As Control = Page.LoadControl("webParts\rss.ascx")
controlRSS.ID =
"id1"

Dim
 wpRSS As GenericWebPart = wpManager.CreateWebPart(x)
wpRSS.ID ="rssID"
wpRSS.Title = "CNN News"
wpManager.AddWebPart(wpRSS, wpZone1, 1)
_______________________________________
Now, to access to all the user webparts:
For Each wp As GenericWebPart In wpManager.WebParts
   if wp.ID = "rssID" then do something --DON'T WORK
Next

My problem : I need to check if the user have the wpRss webpart in his webparts collection but I can't set the ID of the webPart before to add it...

Someone have an idea ?  M. Harder?

Thanks,
Iannick

 




 

kovalov
Asp.Net User
Re: How to access asp_personalizationPerUser ?5/1/2006 8:34:34 PM

0/0

Have exactly the same problem. The ID field gets reassigned by the framework to a random number (something like "wp580609608"). Any ideas how to solve the problem?

 

And another question. Is there any way to access User specific data (declared as Personalizable property inside an "ascx" webcontrol) for a dynamically created web part?

 

ilegare76
Asp.Net User
Re: How to access asp_personalizationPerUser ?5/1/2006 8:59:22 PM

0/0

>>And another question. Is there any way to access User specific data (declared as >>Personalizable property inside an "ascx" webcontrol) for a dynamically created web part?

I think you must use the profile
Take a look on this post:
http://forums.asp.net/thread/1269001.aspx

kovalov
Asp.Net User
Re: How to access asp_personalizationPerUser ?5/2/2006 3:04:27 PM

0/0

Probably not the best solution, but very simple:


Dim controlRSS As Control = Page.LoadControl("webParts\rss.ascx")
controlRSS.ID =
"id1"

Dim
 wpRSS As GenericWebPart = wpManager.CreateWebPart(x)
wpRSS.Description ="rssID"
wpRSS.Title = "CNN News"
wpManager.AddWebPart(wpRSS, wpZone1, 1)
_______________________________________
Now, to access to all the user webparts:
For Each wp As GenericWebPart In wpManager.WebParts
   if wp.Description = "rssID" then do something

Next

 

Sertenly, Description field should be unique.

ilegare76
Asp.Net User
Re: How to access asp_personalizationPerUser ?5/2/2006 6:54:06 PM

0/0

Hello,
In my situation (I have my own catalog), I think that's a good solution.  I haven't seen the description property, thanks.

Description property:
Gets or sets a brief phrase that summarizes what a control does, for use in ToolTips and catalogs of server controls.

Thanks,

Iannick
P.S. If someone have a solution with the ID, send me an email !

ilegare76
Asp.Net User
Re: How to access asp_personalizationPerUser ?5/4/2006 12:26:32 AM

0/0

OK, my last comments about this post:

From David Barkol
You can only set the id of the control that you are loading but not on a
webpart that you create dynamically.


Iannick

vishal_7
Asp.Net User
Re: How to access asp_personalizationPerUser ?5/4/2006 6:47:11 PM

0/0

HI,

  I am adding dynamic webparts as well. I extended the standard WebPartManager with my own so that I can call the SetPersonalizationDirty Function to save the webpart into the users personalization profile. The problem is now that when I reload a second window then it re-adds those webparts again - so 2 webparts becomes 4 then 4 becomes 8 etc....How can I get rid of that? I think I need to check if certain webparts are already added to the users personalization and if not then I need to add them. Is that the way it should work?

Please advice.

Thanks

mharder
Asp.Net User
Re: How to access asp_personalizationPerUser ?5/8/2006 8:54:14 PM

0/0

Original question: You shouldn't work directly against the data in the database.  Have you tried using the WebPartManager.AuthorizeWebPart method?

Saving arbitrary data on WebPart: You could use the AuthorizationFilter property.  This is a string property designed to hold data related to whether a WebPart is authorized for the page.  For instance, you could set this property to a list of allowed user roles.

Adding dynamic WebParts multiple times: This has been covered many times before.  Search for terms like "static webpart", "dynamic webpart", and "SetPersonalizationDirty()".

-Mike

http://blogs.msdn.com/mharder

This posting is provided "AS IS" with no warranties, and confers no rights.
pkellner
Asp.Net User
Re: How to access asp_personalizationPerUser ?6/2/2006 5:04:24 AM

0/0

Hi Mike,

Just a quick follow up question.  Is there any way with the webpartsmanager to reset (or delete) the entry in the aspnet_PersonalizationPerUser for the current user?  I don't want to go directly against the database, but I don't see another way to do it.

Thanks


Peter Kellner
http://73rdstreet.com and blogging at
http://PeterKellner.net
MVP, ASP.NET
volant
Asp.Net User
Re: How to access asp_personalizationPerUser ?6/2/2006 7:07:22 PM

0/0

pkellner:

Hi Mike,

Just a quick follow up question.  Is there any way with the webpartsmanager to reset (or delete) the entry in the aspnet_PersonalizationPerUser for the current user?  I don't want to go directly against the database, but I don't see another way to do it.

Thanks

 
 WebPartManager _manager
        = WebPartManager.GetCurrentWebPartManager(Page);
        
    _manager.Personalization.ResetPersonalizationState();
 
pkellner
Asp.Net User
Re: How to access asp_personalizationPerUser ?6/3/2006 7:25:32 PM

0/0

thanks.  worked perfect. 
Peter Kellner
http://73rdstreet.com and blogging at
http://PeterKellner.net
MVP, ASP.NET
12 Items, 1 Pages 1 |< << Go >> >|


Free Download:


Web:
How to access asp_personalizationPerUser ? - ASP.NET Forums How to access asp_personalizationPerUser ? Rate It (2). Last post 06-03-2006 3: 25 PM by pkellner. 11 replies. Sort Posts: ...




Search This Site:










per user downloads module

how to run 'classic' asp pages on asp.net development server

can't add custom module to page in 3.0.12

object reference not set to an instance of an object

please help with ad form authentication

dnn roadmap

upgrade error error: (connectionstring)

datasource for administrators to edit userid and passwords from aspnetdb.mdf

unrecognized tag prefix 'asp' ??!!

stop masterpage from reloading

probs with studio crashing in vb files

asp:menu click event not getting fired

sql server does not exist

:: grr :: more major issues with july ctp of vs2005

login problem

containers title box height

userid as uniqueidentifier

newb coming from cf

german version of hotfix

how can i programmatically administer users?

data block

respond with 401 and page in customerrors section.

treeview menu loading slow

authentication problem

error upgrading from 2.1.2 -> 3.0.12 help!

asp to asp.net help urgent

last tactical straw, need a new host

can't send e-mail

dnn3.0.13 - nested table (free module)

how to implement an custom image control

 
All Times Are GMT