Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 28th, 2008, 07:15 AM
Authorized User
 
Join Date: May 2007
Location: Hyderabad, Andhra Pradesh, India.
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.

  #2 (permalink)  
Old February 28th, 2008, 07:20 AM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
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 -/
  #3 (permalink)  
Old February 28th, 2008, 07:30 AM
Authorized User
 
Join Date: May 2007
Location: Hyderabad, Andhra Pradesh, India.
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?

  #4 (permalink)  
Old February 28th, 2008, 07:48 AM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
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 -/
  #5 (permalink)  
Old February 28th, 2008, 10:46 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
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
  #6 (permalink)  
Old March 16th, 2008, 06:20 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hampshire, United Kingdom.
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>
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 04:09 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.