473,396 Members | 1,995 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,396 software developers and data experts.

Call a function on another WebForm?

Would like to call the TabShow function on WebForm InOutHost from another
WebForm in same project, but cannot figure out how to get a reference. Can
this be done? In this statement: Call InOutHost.TabShow("pagBoard"), the
reference to InOutHost is not resolved. Thanks, Dean S
Partial Public Class InOutHost

Inherits System.Web.UI.Page

'function

Public Sub TabShow(ByVal strTabName As String)

Select Case strTabName

Case "pagSearch"

tabInOut.SelectedTab =
tabInOut.Tabs.IndexOf(tabInOut.Tabs.FromKey("pagSe arch"))

Case "pagBoard"

tabInOut.SelectedTab =
tabInOut.Tabs.IndexOf(tabInOut.Tabs.FromKey("pagBo ard"))

Case Else

'error message

End Select

End Sub

End Class

Partial Class Search

Inherits System.Web.UI.Page

Call InOutHost.TabShow("pagBoard")

End Class
Apr 3 '06 #1
3 3500
Create a base class, or a utility function. You want to access a member of
a something that doesn't exist. If this is truly functionality that both
pages offer, you should place it in a base class, which inherits Page, and
make your 2 pages inherit from it

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Dean Slindee" <sl*****@charter.net> wrote in message
news:vV***********@fe07.lga...
Would like to call the TabShow function on WebForm InOutHost from another
WebForm in same project, but cannot figure out how to get a reference.
Can this be done? In this statement: Call InOutHost.TabShow("pagBoard"),
the reference to InOutHost is not resolved. Thanks, Dean S
Partial Public Class InOutHost

Inherits System.Web.UI.Page

'function

Public Sub TabShow(ByVal strTabName As String)

Select Case strTabName

Case "pagSearch"

tabInOut.SelectedTab =
tabInOut.Tabs.IndexOf(tabInOut.Tabs.FromKey("pagSe arch"))

Case "pagBoard"

tabInOut.SelectedTab =
tabInOut.Tabs.IndexOf(tabInOut.Tabs.FromKey("pagBo ard"))

Case Else

'error message

End Select

End Sub

End Class

Partial Class Search

Inherits System.Web.UI.Page

Call InOutHost.TabShow("pagBoard")

End Class

Apr 3 '06 #2
Both WebForms exist in the same project. Each has a very distinct/different
task to accomplish, so they have nothing (but residing in the same project)
in common. Can you tell me whether it is possible for two WebForms to
communicate with each other. This can be done with WinForms, easily. Just
want to know if it's possible with WebForms, and how.
Thanks,
Dean S
"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
net> wrote in message news:Oy**************@TK2MSFTNGP10.phx.gbl...
Create a base class, or a utility function. You want to access a member
of a something that doesn't exist. If this is truly functionality that
both pages offer, you should place it in a base class, which inherits
Page, and make your 2 pages inherit from it

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Dean Slindee" <sl*****@charter.net> wrote in message
news:vV***********@fe07.lga...
Would like to call the TabShow function on WebForm InOutHost from another
WebForm in same project, but cannot figure out how to get a reference.
Can this be done? In this statement: Call InOutHost.TabShow("pagBoard"),
the reference to InOutHost is not resolved. Thanks, Dean S
Partial Public Class InOutHost

Inherits System.Web.UI.Page

'function

Public Sub TabShow(ByVal strTabName As String)

Select Case strTabName

Case "pagSearch"

tabInOut.SelectedTab =
tabInOut.Tabs.IndexOf(tabInOut.Tabs.FromKey("pagSe arch"))

Case "pagBoard"

tabInOut.SelectedTab =
tabInOut.Tabs.IndexOf(tabInOut.Tabs.FromKey("pagBo ard"))

Case Else

'error message

End Select

End Sub

End Class

Partial Class Search

Inherits System.Web.UI.Page

Call InOutHost.TabShow("pagBoard")

End Class


Apr 4 '06 #3
A WebForm is just a class.

When a page is requested, an instance of the given webform is created.

No instance of the 2nd webform exists, so only static/shared members can be
accessed. In other words you can't access Page2 because it doesn't exist at
that given time.

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Dean Slindee" <sl*****@charter.net> wrote in message
news:ZP**************@fe06.lga...
Both WebForms exist in the same project. Each has a very
distinct/different task to accomplish, so they have nothing (but residing
in the same project) in common. Can you tell me whether it is possible
for two WebForms to communicate with each other. This can be done with
WinForms, easily. Just want to know if it's possible with WebForms, and
how.
Thanks,
Dean S
"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
net> wrote in message news:Oy**************@TK2MSFTNGP10.phx.gbl...
Create a base class, or a utility function. You want to access a member
of a something that doesn't exist. If this is truly functionality that
both pages offer, you should place it in a base class, which inherits
Page, and make your 2 pages inherit from it

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Dean Slindee" <sl*****@charter.net> wrote in message
news:vV***********@fe07.lga...
Would like to call the TabShow function on WebForm InOutHost from
another WebForm in same project, but cannot figure out how to get a
reference. Can this be done? In this statement: Call
InOutHost.TabShow("pagBoard"), the reference to InOutHost is not
resolved. Thanks, Dean S
Partial Public Class InOutHost

Inherits System.Web.UI.Page

'function

Public Sub TabShow(ByVal strTabName As String)

Select Case strTabName

Case "pagSearch"

tabInOut.SelectedTab =
tabInOut.Tabs.IndexOf(tabInOut.Tabs.FromKey("pagSe arch"))

Case "pagBoard"

tabInOut.SelectedTab =
tabInOut.Tabs.IndexOf(tabInOut.Tabs.FromKey("pagBo ard"))

Case Else

'error message

End Select

End Sub

End Class

Partial Class Search

Inherits System.Web.UI.Page

Call InOutHost.TabShow("pagBoard")

End Class



Apr 4 '06 #4

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

Similar topics

0
by: Andrew | last post by:
Hi, Until now, I have used a single webform for my web app, and everything's been OK. Now, I've decided to create a main menu webform. So, I've got two webforms. Using Visual Studio .NET (with...
3
by: Prasad Patil | last post by:
Hi, I have a webform, The link on the webform should call the exe program installed on the client machine when the user click the link on the webform. It should run the exe installed on the...
3
by: Olly | last post by:
Hi all: Sorry for a dumb question, but how to define the following JS function? Many thanks. Olly ========> function checkForm()
6
by: dave | last post by:
I have a webform with many checkboxes on it. I want the user to be able click on a button and the page be posted to another webform so that I can capture which checkboxes were selected. For all...
27
by: Jason Shohet | last post by:
I have an ascx control, and it needs a value called 'orgID' which the parent page will have. I want to avoid the parent page setting values in fields on the ascx control since this violates...
3
by: Shasta | last post by:
Using VB.NET how can I call a java Function from WebForm Button control? Any example code:? -- Tek Gurus Inc President
9
by: Leon | last post by:
I have a webform in which when the user press generate button the form generate six unique ramdon numbers, the user can also type these six numbers in manually in any order. however, the user can...
2
by: Luqman | last post by:
How can I open another WebForm in ASP.Net / VS 2005 without closing the Current Webform. I tried using Server.Transfer("Form2.Aspx",True) on Button_Click of Form1 but it close the current web...
5
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi I have start web form and when the user clicks a button (server.transfer) they are directed to the second webform. I was wondering if there is a way to create an instance of the first webform...
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: 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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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,...

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.