473,461 Members | 2,023 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Referring to a control on another page

What is the syntax to reference a control on another page? I have a class
module that I would like to code to change parameters on a series of
controls on a web page. There are to many to pass by reference. Is there a
way to do something like

pgMain.cmd1.enabled = true;

pgMain.cmd2.enabled = true;

pgMain.cmd3.enabled = true;

.......

Any help is greatly appreciated.


Nov 19 '05 #1
1 1461
"Greg Smith" <gj*@umn.edu> wrote in message
news:eG**************@TK2MSFTNGP10.phx.gbl...
What is the syntax to reference a control on another page? I have a class
module that I would like to code to change parameters on a series of
controls on a web page. There are to many to pass by reference. Is there
a way to do something like


If this class (one no longer says "class module") is specifically for this
one page (as it must be since it is meant to touch this large set of
controls), then perhaps it should be part of that page.

Do you see yourself reusing this same class for a different page? If so,
then perhaps the set of controls to be manipulated by this class should be
broken out into their own UserControl, and perhaps the logic from your class
should become part of the UserControl. Are these controls physically
contiguous?

If your class knows details about the page, then you can give it access to
the page by passing "Me" to it:

Public Class WebForm1
Inherits System.Web.UI.Page
Friend WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
Friend WithEvents TextBox2 As System.Web.UI.WebControls.TextBox
Friend WithEvents TextBox3 As System.Web.UI.WebControls.TextBox

#Region " Web Form Designer Generated Code "
#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim c1 As New Class1()
c1.EnableControls(Me)
End Sub
End Class

Public Class Class1
Public Sub EnableControls(ByVal page As WebForm1)
page.TextBox1.Enabled = True
page.TextBox2.Enabled = True
page.TextBox3.Enabled = True
End Sub
End Class

But notice that Class1 can only be used by one page. In this case, there's
no real sense in creating a class for it - it should be part of the page.

John Saunders
Nov 19 '05 #2

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

Similar topics

2
by: John Lau | last post by:
Hi, Is there documentation that talks about the page lifecycle, the lifecycle of controls on the page, and the rendering of inline code, in a single document? Thanks, John
3
by: Microsoft | last post by:
How do I refer to the content of one frame from another frame. Depending on which command button is pressed in one frame I wish to chnage what is displayed in another frame. Thanks Colin
20
by: Guadala Harry | last post by:
In an ASCX, I have a Literal control into which I inject a at runtime. litInjectedContent.Text = dataClass.GetHTMLSnippetFromDB(someID); This works great as long as the contains just...
3
by: Dan Sikorsky | last post by:
How can I get the Querystring passed to the Referring Page from its referrer? I don't want the querystring coming to my current page. I want the querystring that came to the referring page, so...
0
by: tollhund | last post by:
Alright, what I am basically trying to do is forward a site based on the referring site. For example a domain that I cannot control is linking a pop-up to a page on my website. I would like to...
1
by: pradeep_TP | last post by:
Hello everybody, I have created a web site which has a simple user control (LogoDisplay.ascx). This is part of a separate project called CommonControls. I have a main Project "MainProj" from...
5
by: Christina | last post by:
I can't seem to find any reference for grabbing the title of the referring page, which I want to use for creating a link. i.e. document.write ("Our thanks to <a href='"+document.referrer+"'>"...
2
by: paladin | last post by:
We have a strange situation where some of the referring URL's are missing from our log files. This is on .NET application on IIS 6.0. Here is what is happening: Page a.aspx has a form that...
4
by: CG | last post by:
Hi I need to implement some low level security that locks a certain page if the user does come from a particular link (which is hosted on another domain). I've considered using HTTP_REFERER...
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...
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
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.