I'm using ASP.NET (C#) in Visual Studio. I'm trying to make it as much like windows programming as possible, so I'm trying to add my custom control (ImagePreview Ctrl) to my aspx page programmatically. I created a custom control and it's compiled as an assembly. When I drop the control onto my aspx page in the designer, it adds the line:
<cc1:ImagePreviewCtrl id="ImagePreviewCtrl1" runat="server"></cc1:ImagePreviewCtrl>
to the HTML source. That's as much modification as I want to do to the HTML source. I want to do the rest of the initialization and customization in the aspx.cs file. However, when I drop the control onto my page, the control is not automatically instantiated in the aspx.cs file. There is no reference to ImagePreviewCtrl1 in the .cs file at all. How do I change its properties if there is no object? I tried adding the line:
protected ImagePreview.ImagePreviewCtrl ImagePreviewCtrl1;
to the .cs file and assigning values to its properties, but I get a web application error.
What am I doing wrong? It has to be something simple.
Thanks in advance.
<cc1:ImagePreviewCtrl id="ImagePreviewCtrl1" runat="server"></cc1:ImagePreviewCtrl>
to the HTML source. That's as much modification as I want to do to the HTML source. I want to do the rest of the initialization and customization in the aspx.cs file. However, when I drop the control onto my page, the control is not automatically instantiated in the aspx.cs file. There is no reference to ImagePreviewCtrl1 in the .cs file at all. How do I change its properties if there is no object? I tried adding the line:
protected ImagePreview.ImagePreviewCtrl ImagePreviewCtrl1;
to the .cs file and assigning values to its properties, but I get a web application error.
What am I doing wrong? It has to be something simple.
Thanks in advance.