473,378 Members | 1,498 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

pls HELP: webpart acting as shared but should be user

I have an almost finished page that uses webparts. And this is the
expected functionality. A logged on user hits a button and the button
opens a WebPart. Then the user logs off, next time he logs on he will
find the webpart already open. Now, if a different user logs on, the
fact that another user might have opened a webpart should not affect
the page. For him the page should only show webparts that were open
inside his session.
This is not what is happening right now. Currently, if a user opens a
webpart, and then a different user logs on, the newly logged user will
have whatever webparts that he might have opened in the past plus the
ones opened by other user. Almost like the webpage was being modified
by everybody.

I am creating the WebParts dynamically from user controls using the
LoadControl command; then I use the WebPartManager.CreateWebPart and
last WebPartManager.AddebPart.

I have looked at my config file and the code and everything looks fine.
When I steep through the code after the webpart has been created I can
see this variables.
WebPartManager1.Personalization.HasPersonalization State equals True
WebPartManager1.Personalization.Scope is user
WebPartManager1.Personalization.Enabled equals True

Does anybody know what I am doing wrong? Do I need to save the state?
Arturo Hernandez

May 3 '06 #1
2 1632
DWS
Hey Atherton,
Please post some code for the group to help you or try using the
declaritiviecatalog part.

Good Luck
DWS

"arthernan" wrote:
I have an almost finished page that uses webparts. And this is the
expected functionality. A logged on user hits a button and the button
opens a WebPart. Then the user logs off, next time he logs on he will
find the webpart already open. Now, if a different user logs on, the
fact that another user might have opened a webpart should not affect
the page. For him the page should only show webparts that were open
inside his session.
This is not what is happening right now. Currently, if a user opens a
webpart, and then a different user logs on, the newly logged user will
have whatever webparts that he might have opened in the past plus the
ones opened by other user. Almost like the webpage was being modified
by everybody.

I am creating the WebParts dynamically from user controls using the
LoadControl command; then I use the WebPartManager.CreateWebPart and
last WebPartManager.AddebPart.

I have looked at my config file and the code and everything looks fine.
When I steep through the code after the webpart has been created I can
see this variables.
WebPartManager1.Personalization.HasPersonalization State equals True
WebPartManager1.Personalization.Scope is user
WebPartManager1.Personalization.Enabled equals True

Does anybody know what I am doing wrong? Do I need to save the state?
Arturo Hernandez

May 4 '06 #2
OK, here goes nothing:

Private Function GetWebPart(ByRef WebPartType As ChuyWebPart) As
WebPart
Dim _WebPart As WebPart
For Each _WebPart In WebPartManager1.WebParts
If _WebPart.Title = WebPartType.DisplayName Then
Return _WebPart
End If
Next
Return Nothing
End Function

Private Function OpenWebPart(ByRef WebPartType As ChuyWebPart,
ByRef pWebPartZone As WebPartZone, ByVal ZoneIndex As Integer) As
WebPart
Dim _GenericWebPart As GenericWebPart
_GenericWebPart = GetWebPart(WebPartType)
If _GenericWebPart Is Nothing Then
Dim _UserControl As UserControl = LoadControl("~\Controls\"
+ WebPartType.ControlName + ".ascx")
_UserControl.ID = WebPartType.ControlName
_GenericWebPart =
WebPartManager1.CreateWebPart(_UserControl)
_GenericWebPart.Title = WebPartType.DisplayName
End If
If Not _WebPartManager1.WebParts.Contains(_GenericWebPart ) Then
_GenericWebPart =
WebPartManager1.AddWebPart(_GenericWebPart, pWebPartZone, ZoneIndex)
End If

Return _GenericWebPart
End Function

There is something I probably need to clarify about my code. I was not
able to make a reference to the user control by type. So as a
workaround the only way I found to get a reference to a WebPart was to
use it's title. I will probably end up undoing this workapound whenever
I find a better way to do that.

Anyway any help will be greately appreciated

May 4 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: ALI-R | last post by:
I'm writing a webpart which is supposed to connect to a Webserice in our interanet.I am using "RSService.Credentials = System.Net.CredentialCache.DefaultCredentials;"to Authenticate to the...
0
by: Joe L via .NET 247 | last post by:
I have written a web part. The webpart calls a web service toget info. I ran into problems with the webservice notresponding. We decided to have a cutoff for the time to waitfor a response from...
0
by: J. Jespersen | last post by:
Hi people, I fiddling with webparts, and have created my own custom webpart from scratch. The webpart itself is contained in a myPart.dll I have two different sites. SiteA and SiteB. Both are...
1
by: kjartan93a | last post by:
The following code is on my master page, site.master.cs: // programatically add a WebPart from a User Control file Control uc = this.LoadControl(@"ucLotListSimple.ascx"); uc.ID = "MyWp";...
0
by: arthernan | last post by:
I have an almost finished page that uses webparts. And this is the expected functionality. A logged on user hits a button and the button opens a WebPart. Then te user logs off, next time he logs on...
0
by: Bei | last post by:
Now I'm facing a requirement that every users can personalize their own web parts, and there is a administrator who has rights 1, to publish a 'personalization' of a single web part to all users in...
0
by: =?Utf-8?B?U2hhbg==?= | last post by:
Hi, I need to develop a web-application, which use form based authentication. In this application, administrator can create a role and add users to the role. I have a requirement where the...
0
by: Manpreet | last post by:
Hi, I have a web part page with a toolbar webpart and a grid webpart. In the toolbar, I have menu-items to update a field. For selecting the value of the field I have another asp.net webform...
4
by: Don | last post by:
I am creating my first WebPart and I’m having trouble figuring out how everything works together. How do I configure a WebPart with settings that will be the same for all users? For example,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.