Why I get error "There was an error rendering..."

J

Jarod

Hey
When I put my control into DetailsView in a template I see it and it seems
as working ok. After compile it works on the page. But in normal view in
designer I don't see my detailsView instead of it I see "There was error
rendering the control. Object not set to an instance of object".
My control is derived from linkButton and I just needed to add a few
properties but rendering stays the same. For real I just override click
event and set something to Text property. And if I put this control on a
page it works. It doesn't render in designer view of detailsView only :( Can
you help ?
Jarod
 
M

Matt Dinovo

Without seeing what you're overriding, I can only take a guess.

The designer does load the control so you will go through several of the
normal 'rendering' events (e.g. Load, CreateChildControls, etc.). I'm
guessing you are changing the Text property to a value of an object that you
only have at runtime. You should wrap that call with a If..Then checking the
design mode something like below:

If Me.Site Is Nothing OrElse Not Me.Site.DesignMode Then
'TODO: Set the text to whatever object you're already setting it to
'Me.Text = <whatever it is that you're doing>
End If

HTH,

Matt Dinovo
 

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

Members online

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top