Inheriting from an ASP.NET control
Imar,
I am trying to extend the material from Chapter 8 to my application.
I want to have an asp:FileUpload control for use within an asp:UpdatePanel. The button on FileUpload does not have an AutoPostBack attribute. One of the recommended ways I have found from a Google search is to include another button to actually upload the file.
What I have tried to do is derive from asp:FileUpload thusly:
I started a new control, as you did in Chapter 8. In the .cs file I have
public partial class Controls_FileUpload_trk : FileUpload, IPostBackEventHandler
in the ascx file I have only a single line
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Controls_FileUpload_trk.ascx.cs" Inherits="Controls_FileUpload_trk" %>
In the aspx file where I want to situate the control I have
<%@ Register Src="~/Controls/Controls_FileUpload_trk.ascx" TagName="Controls_FileUpload_trk" TagPrefix="trk" %>
I cannot place the control, and when it is compiled I get the error
error ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl).
Any help would be appreciated and / or a direction to a source that would help me solve this.
Thanks.
|