Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
|
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 28th, 2008, 07:15 AM
Authorized User
 
Join Date: May 2007
Posts: 95
Thanks: 5
Thanked 0 Times in 0 Posts
Default How to inherit control of one page to another page

Hi All

I m developing a web application using C#, ASP.NET 2.0 and SQL Server 2005. I am using Visual Studio 2005 Pro. Edition.

Please tell me how to inherit a asp control button to another page. For e.g if an asp button is there in the customer.aspx, then same control event should appear in the intellisense of other different page, say product.cs. How to do that? Please explain me by showing codes.

 
Old February 28th, 2008, 07:20 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

What would the button do exactly?

Are you talking about a button you want to appear on all your web pages? I which case I'd advise looking into Master Pages (do a search in the Visual Studio docs for how to implement them).

If not, then you'll have to explain in more detail what you are trying to achieve.

/- Sam Judson : Wrox Technical Editor -/
 
Old February 28th, 2008, 07:30 AM
Authorized User
 
Join Date: May 2007
Posts: 95
Thanks: 5
Thanked 0 Times in 0 Posts
Default

I am not using any master pages. There are two different pages customer.aspx and product.aspx. An asp button named 'Go' is there in Product.aspx.In product.cs page i m getting all events related to button like btnGo, btnGo_Clicked etc.(which is normal), now what i want is that this same thing should come in one different cs page, say customer.cs. How to do that? i want to inherit that control?

Did you got my point?

 
Old February 28th, 2008, 07:48 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

No, I didn't.

I didn't say you where using Master Pages - I said you might WANT to to solve your problem.

Alternatively you might want to add your Go button into a user control, and add that user control to the two web pages.

/- Sam Judson : Wrox Technical Editor -/
 
Old February 28th, 2008, 10:46 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

I too don't understand what you are getting at. Two pages can't be loaded at the same time, so you can't have a button on one page result in an event firing on another (there are some tricks with cross-page postbacks). Perhaps you could explain what the eventual desired outcome is that you are looking to achieve such as "I click button 'Go' on the product page, and X happens on the customer page."

-Peter
peterlanoie.blog
 
Old March 16th, 2008, 06:20 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

I too do not understand what you are driving at. I think it may be one of two scenarios:

1. You want to create a customised button control to add to both pages (meaning the same members are available to both pages).
2. You want one button when clicked on "customer.aspx" to do something on "products.aspx".

If its 1, listen to what samjudson said, create a user control.
If its 2, listen to what planoie said, you cant have two pages loaded at the same (or at least to my knowledge - which, to be fair is limited).

Before asking for code, it may be preferable to ensure you are asking your question as explicitly as possible, giving as much info to those you are asking for help ;)

Rob
The Developing Developer
Currently Working Towards: MCAD C#
My Blog: http://www.robzyc.spaces.live.com
<center>"Nothing can stop the man with the right mental attitude from achieving his goal;
nothing on earth can help the man with the wrong mental attitude".

Thomas Jefferson</center>





Similar Threads
Thread Thread Starter Forum Replies Last Post
Access Master page control from Content page. angshujit ASP.NET 2.0 Basics 3 January 11th, 2007 06:20 AM
how to access a control from another page labelle ASP.NET 1.0 and 1.1 Basics 0 January 10th, 2007 04:23 AM
Control Focus of Page mahulda General .NET 1 July 23rd, 2004 08:52 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.