473,473 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

ASP.Net VB Web Parts - Connections work fine, until I close, then reopen a web part.

Accidentally put this in normal ASP newsgroup, so reposting:

I'm just starting out with ASP.net, making a web parts intranet.

I'm triyng to get some basic web parts (ascx files) working on a page,
I want them to share a variable, 'StaffID' which one part generates by
looking up the windows login name of the person viewing the page, and
then queries the database to find out the StaffID associated with that
name.

That part then shares it with all the other parts, using a class
called "IMessage", I have set up static connections for each
individual part,

The main part, Jobs_Main.ascx has this code:

Public ReadOnly Property Message() As String _
Implements IMessage.Message
Get
Return StaffID
End Get
End Property

<ConnectionProvider("Message", AllowsMultipleConnections:=True)_
Public Function GetMessage() As IMessage
Return Me
End Function

to assign the StaffID (which is generated on Page_Load - I also tried
Page_Init and this made no difference)

and then the other parts use

Public _message As IMessage

<ConnectionConsumer("Message")_
Sub SetMessage(ByVal message As IMessage)
Me._message = message
End Sub

in the scripts and then:
If (Not (_message) Is Nothing) Then
StaffID = "" & _message.Message & ""
Else
StaffID = 1
End If

That all works beautifully. If I change the staffID manually on
Jobs_main(in the code) all the others update next refresh. However I
have put in a catalog, and when I close a web part (the part I was
trying was FavouriteLinks.ascx) then add it again, it defaults to the
StaffID of 1...

So I assume it is not getting the _message value, or it thinks the
_message value is 0 for some reason? Does anyone know why this would
be? Could it be that it is loading before the jobs_main web part? If
so how do I make it load afterwards?

May 3 '07 #1
1 1040
anyone who cares, I instead dessided to go with a 'master page' and
use a Session("StaffID") variable

May 15 '07 #2

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

Similar topics

5
by: brett valjalo | last post by:
Hey Gang! SORRY ABOUT THE LENGTH! Nice to see some of the same faces around this place from way back when ... Whatta buncha CDMA addicts some o' y'all are ;) Don't get me wrong, I...
17
by: Peter Proost | last post by:
Hi Group, I've got an interesting problem, I don't know if this is the right group but I think so because everything I've read about it so far says it's a .net problem. Here's the problem, we're...
4
by: Chris | last post by:
I am using the following function in a windows service. It is fired off by a file system watcher component. It works fine, except for I'll copy in 20 files it has to process at one time. I'll...
45
by: Arno R | last post by:
Hi all, I am about to distribute an A97-runtime app. which will be used on a LAN by approx. 30 users. The network is pretty good, but there are a few managers who have wireless laptops... Of...
3
by: db.guru | last post by:
Hello, I was wondering what the best practices are as far as how many connections one should use for a data-driven app. Here's my situation: I have a business object that I load data into, this...
37
by: Joshua Ruppert | last post by:
When I'm using FastCGI do I need to code differently than I do when using regular CGI? Because the PHP.exe processes don't go away do global variables stick around from page request to page...
11
by: atlaste | last post by:
Hi, In an attempt to create a full-blown webcrawler I've found myself writing a wrapper around the Socket class in an attempt to make it completely async, supporting timeouts and some scheduling...
1
by: cleanwire | last post by:
Using ASP.Net 2.0 I've created a page with web parts. While using the page, I chose to close the web parts. Now the web parts are gone,even when I close & reopen the browser. How can I get the...
1
by: itfetish | last post by:
I'm just starting out with ASP.net, making a web parts intranet. I'm triyng to get some basic web parts (ascx files) working on a page, I want them to share a variable, 'StaffID' which one part...
0
by: itfetish | last post by:
We have a web parts intranet at our office here I have been working on. I have been trying to create a way of getting our OCE TDS 600 plotter queue to be a web part on the page, seeing as their...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.