开发者

How do you make a control reusable in different projects?

Is there a way to not put the project name in the Inherits attribute?

I am working with vb and I have multiple projects, that have multiple web pages. In each of these projects I create controls that are reused in the web pages.

Each control I have is declared like this:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="MenuBarControl.ascx.vb" Inherits="开发者_如何学Python**projectName**.MenuBarControl" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>

When I want to copy the control into another project I have to change the **projectName**. Having to change the project name for each project makes the code not reusable. Changes made to specific projects each time is not reusable.

I want to be able to omit the project name in the Inherits attribute. When I do that now I get an error

Parser Error

Parser Error Message: Could not load type 'MenuBarControl'.


Just create a new project that includes all the controls, reference that from the web projects.


http://blogs.msdn.com/b/davidebb/archive/2005/10/30/487160.aspx

Basically, you create a DLL and include it in your other projects. Alternatively, you can modify a user control library. More info here: http://webproject.scottgu.com/CSharp/UserControls/UserControls.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜