Ask a Question related to ASP.NET Building Controls, Design and Development.
-
Dave #1
"Text is not allowed between the opening and closing tag"?
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");
}
}
Dave Guest
-
#39640 [NEW]: Segfault with "Allowed memory size exhausted"
From: phpbugs at thequod dot de Operating system: Ubuntu Linux PHP version: 5CVS-2006-11-26 (CVS) PHP Bug Type: Reproducible... -
"Requested registry access is not allowed" and Web Service call
Hey all - I'm having a really confusing problem concerning a web service. Right now, I have an application that needs to call a web service that... -
#26356 [Fbk->Csd]: sporatic "Allowed memory size exhausted" errors
ID: 26356 User updated by: my-junkmail at earthlink dot net Reported By: my-junkmail at earthlink dot net -Status: ... -
#26356 [Opn->Fbk]: sporatic "Allowed memory size exhausted" errors
ID: 26356 Updated by: sniper@php.net Reported By: my-junkmail at earthlink dot net -Status: Open +Status: ... -
#26356 [Opn]: sporatic "Allowed memory size exhausted" errors
ID: 26356 User updated by: my-junkmail at earthlink dot net Reported By: my-junkmail at earthlink dot net Status: ... -
Dave #2
RE: "Text is not allowed between the opening and closing tag"?
The solution is to add:
[PersistenceMode(PersistenceMode.InnerDefaultProper ty)]
public string AlternateText
{ ...
}
"Dave" wrote:
> 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");
> }
> }Dave Guest



Reply With Quote

