views:

336

answers:

2

I want to change Control(@Control) directive in a way to make it redistributable and want to use ClassName attribute

so I changed this

From :

<%@ Control Language="C#" AutoEventWireup="true"  CodeFile="ProductShower.ascx.cs" Inherits="MyCompany.Web.Controls.ProductShower" %>

To :

<%@ Control Language="C#" ClassName="MyCompany.Web.Controls.ProductShower" %>

with this change I get lots of errors saying all my events one by one don't have definitions !

Update:

When I add the ClassName attribute in combination with two others , It causes another error :

Error   4   Missing partial modifier on declaration of type 'MyCompany.Web.Controls.ProductShower'; another partial declaration of this type exists c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\productspanelx2\1f971ff6\ea7644da\App_Web_giywejva.0.cs   138 

in addition to that , the class definition's first line is :

public **partial** class ProductShower : System.Web.UI.UserControl

any ideas ?

+2  A: 

With the new way, you're missing the CodeFile and Inherits attributes.

The Inherits attribute tells the control which class has the code-behind.

GoodEnough
A: 

Inherits and ClassName must point to different classes in the namespace.

If your control inherits from MyCompany.Web.Controls.ProductShower, make your classname be something like that: MyCompany.Web.Controls.ProductShowerControl (that's how we name controls).

GoodEnough