Hey guys,
I've created a CustomFileUpload
class which is inherited from the original FileUpload
class, I'm gonna have to say it's not actually a UserControl
it's a simple class which can be seen below
using System;
using System.Web;
public class CustomFileUpload : System.Web.UI.WebControls.FileUpload
{
public string Directory { get; set; }
}
I need to know how I can use the control in my page, maybe something like <@Registe ...
when we create a usercontrol.
This is called a custom server control. You can read an indepth walkthrough about them. You will need to have the server control reside in an assembly that is separate from your project and then reference the assembly into your project.
The syntax you want to use to put the control on the page is:
<%@ Register Assembly="YourAssemblyName" TagPrefix="myControl" Namespace="YourNamespaceName"%>
Then you can reference the control:
<myControl:CustomFileUpload .... />
An easy way to do this is to add the control to your toolbox. Then you can drag the control from the toolbox onto any page. The Register will be created automatically. To add the control to the toolbox