J
Jonathan Wood
I could really use some help on this.
First of all, I want to create a Web control where I render the control
completely from scratch based on information from a database.
In the book "Beginning ASP.NET 2.0 in C# 2005", it provides an example of
doing this, which is declared as:
public class ConfigurableRepeater : WebControl.
So I tried selecting Add New Item and selected Web User Control (the only
control class available). It created a class declared as:
public partial class Controls_ConfigurableRepeater :
System.Web.UI.UserControl
1. Is there a way to add an override without typing it in manually? (VB and
MFC both support this.) I know I can type it in but I don't necessarily know
which overrides are available or what their call signatures are.
2. To make it like the example in the book, I think I want to derive from
WebControl. If I change it to instead be derived from WebControl, I get the
error "Error 2 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). C:\My Documents\Visual Studio
2005\WebSites\WebSite2\Controls\ConfigurableRepeater.ascx.cs 12 33
C:\...\WebSite2\". Well, I didn't change the class name so the inherits
attribute still seems correct. I know I've changed which class I'm deriving
from but I can't see how to correct that.
3. To make it like the example in the book, I think I also don't want the
partial attribute. If I remove the partial attribute, I get the error "Error
2 Missing partial modifier on declaration of type
'Controls_ConfigurableRepeater'; another partial declaration of this type
exists C:\My Documents\Visual Studio
2005\WebSites\WebSite2\Controls\ConfigurableRepeater.ascx.cs 12 14
C:\...\WebSite2\." But I can see no way to find this other partial reference
in order to change that.
I guess I'm also confused about the different types of controls.
Any input would be greatly appreciated.
Thanks!
First of all, I want to create a Web control where I render the control
completely from scratch based on information from a database.
In the book "Beginning ASP.NET 2.0 in C# 2005", it provides an example of
doing this, which is declared as:
public class ConfigurableRepeater : WebControl.
So I tried selecting Add New Item and selected Web User Control (the only
control class available). It created a class declared as:
public partial class Controls_ConfigurableRepeater :
System.Web.UI.UserControl
1. Is there a way to add an override without typing it in manually? (VB and
MFC both support this.) I know I can type it in but I don't necessarily know
which overrides are available or what their call signatures are.
2. To make it like the example in the book, I think I want to derive from
WebControl. If I change it to instead be derived from WebControl, I get the
error "Error 2 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). C:\My Documents\Visual Studio
2005\WebSites\WebSite2\Controls\ConfigurableRepeater.ascx.cs 12 33
C:\...\WebSite2\". Well, I didn't change the class name so the inherits
attribute still seems correct. I know I've changed which class I'm deriving
from but I can't see how to correct that.
3. To make it like the example in the book, I think I also don't want the
partial attribute. If I remove the partial attribute, I get the error "Error
2 Missing partial modifier on declaration of type
'Controls_ConfigurableRepeater'; another partial declaration of this type
exists C:\My Documents\Visual Studio
2005\WebSites\WebSite2\Controls\ConfigurableRepeater.ascx.cs 12 14
C:\...\WebSite2\." But I can see no way to find this other partial reference
in order to change that.
I guess I'm also confused about the different types of controls.
Any input would be greatly appreciated.
Thanks!