Tell me more ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

i had stuck in a situation in wich

i have a asp user control i.e ToolBar it contains a menu with menu items : "Remove" & "Hide" & some methods that perfrom the task of menu item click .

i want to use this user control (ToolBar) as parent with other user controls that extends the functioanlity of ToolBar keeping the its basic functionality fixed & mandatory

//<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ToolBar.ascx.cs" Inherits="ToolBar" %> // // // // // // // // // // //

like the child user control (Child1 ) may have menu item "minimize" & "restore" additional to "Remove" & "Hide".

& another child2 user control have "settings" , "Copy" menu items additional to "Remove" & "Hide".

and so on that is each child user control must have a menu with with menu items : "Remove" & "Hide" with their own menu items & functionality .

Any .NET Master please help me to sort out this mess ( making a user control as template for other user control)

Thanks in advance

share|improve this question

closed as off topic by Alex Angas Feb 20 '11 at 0:20

Questions on SharePoint Stack Exchange are expected to relate to SharePoint within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

1 Answer

This sounds like pretty fundamental OOP inheritance applied to ASP.NET

Create a class which includes your basic functionality, ensure it inherits from UserControl, and your child controls will inherit this functionality and include anything else which you declare.

If you're confused about how to do this, here's an intro to inheritance: http://www.csharp-station.com/Tutorials/lesson08.aspx

And here's a tutorial from MSDN on writing UserControls: http://msdn.microsoft.com/en-us/library/a6h7e207(v=vs.71).aspx

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.