Error rendering control


C

Chris

I have created a custom composite control, which is a date picker. It works
fine but in the design view I get am "Error creating control" 'caltext'
could not be set on property 'btnCssClass' (caltext is the string I am
assigning for the cssclass of a button on the control). I don't need it to
display anything in design view, a blank grey box would be fine. It's just
this error sometimes stop the whole page from rendering in design view.

What I am doing wrong. I didn't want to put the whole code up as it is long
winded. Regards, Chris.



Public Property btnCssClass() As String

Get

EnsureChildControls()

Return btnDate.CssClass

End Get

Set(ByVal value As String)

EnsureChildControls()

btnDate.CssClass = value

End Set

End Property
 
Ad

Advertisements

M

marss

Chris said:
Set(ByVal value As String)

EnsureChildControls()

btnDate.CssClass = value

End Set

End Property

Try this, in design-time HttpContext.Current is null.

Set(ByVal value As String)
If (HttpContext.Current <> null) Then
EnsureChildControls()
btnDate.CssClass = value
End
End Set

End Property
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top