![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Here's my custom control (taken and modified from ASP.NET Unleashed 2.0)... cc1:ImageRotator ID="ImageRotator1" runat="server" cc1:ImageItem AlternateText="first item..." / cc1:ImageItem AlternateText="second item..." / cc1:ImageItem>abc</cc1:ImageItem> <--ERROR appears here. /cc1:ImageRotator However, the control runs and the literal content "abc" gets parsed OK. What do I have to do so Visual Studio doesn't show this error at compile or the IDE?. It works but is misleading if other developers want to use this control in their apps. The code for the ImageItem class is below...if literal text is placed between I want to default it to set the AlternatingText property. Just like the ListItem text defaults to the Text property. .... public class ImageItem : IParserAccessor { private string _imageUrl; private string _alternateText; public string ImageUrl { get { return _imageUrl; } set { _imageUrl = value; } } public string AlternateText { get { return _alternateText; } set { _alternateText = value; } } //only called when there is literal text placed between open/close tags public void AddParsedSubObject(object obj) { if (obj is LiteralControl) this.AlternateText = ((LiteralControl)obj).Text; else throw new System.Web.HttpException("Error parsing ImageItem class"); } } |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |