Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
| Search | Today's Posts | Mark Forums Read
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET 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 June 4th, 2008, 11:51 PM
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default Web User Control to act on interface shared method

Hi All,
I wish to build a user control that performs GUI related actions on a web page.
The issue I have is that it also need to call some methods on an object that will be different from page to page. The Methods that are required are all common, but the implimentation is different. It also need to execute some methods on the page that will be different from page to page.

I have started by creating an interface for the methods that need to be implimented.
And I have created events to wire the page methods to.

This is all fine except that I am unsure of how to design the control to allow any object that impliments the interface to be acted on.

At first I created a property of the interface type. This seemed to work except that the methods that need to be called are "Shared"(I think this is right, I am c# developer on VB project, I would say "static").

I am getting some issue with assigning the Shared 'class' to the property.

Im a bit lost here so please excuse my confusion.

I think I need to utilise Generics to allow the object to be used as a shared object.

Can anyone provide some direction for this situation.

Current state of play in pseudo is:

Interface IPageHandler
 method1()
 method2()

Class MyBusObject:IPageHandler
 method1()
 method2()

Class MyControl:
 private IPageHander pageHandler
 public IPageHander PageHandler{get & set pageHandler}
 public event event1
 Button1_OnClick()
{
 pageHandler.method1()
 raise event1
}
Button2_OnClick()
{
 pageHandler.method2()
 raise event2
}

Page
Onload
{
 Control myControl = new MyControl()
 myCOntrol.PageHandler = MyBusObject //This is where the issue is.
 wire event1 and event2 from mycontrol
}

How is this best done?
I feel an implimentation of generics is required but I am not sure how to impliment this.

Many thanks for you time in reading this.


======================================
"They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad."
--Shakespeare
======================================
__________________
======================================
"They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad."
--Shakespeare
======================================




Similar Threads
Thread Thread Starter Forum Replies Last Post
Add Windows User control in Web User Control agarwalvidhu C# 0 March 30th, 2006 01:17 AM
Web user control EvilGuyWhoEatsBrains General .NET 1 December 14th, 2004 01:21 PM
Web User Control Problem shmacgregor VS.NET 2002/2003 18 February 22nd, 2004 06:29 PM
Fire WebForm Method from User Control bamirzada C# 0 August 21st, 2003 03:16 PM





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