Telerik Controls in Web Custom Controls

I work at a .Net Application Development company and the other day I didn’t have anything to do, so I decided to change one of my User Controls into a Web Custom Control (ASP.Net Server Control) because I was told that we might want to use it in some of the other projects we have or are going to start in the near future.

I had never made a server control before and from what I had seen here and there I thought that this might be somewhat of a challenge. Thankfully it was easier then I thought it would be and I was successful fairly quickly.

Then one of my co-workers came up with the brilliant idea to make it’s ‘parent’ into a server control, so I started work on that.

This ‘parent’ was a collection of a Fieldset with a legend, 2 radiobuttons, 2 instances of my new server control and 2 rad controls.

When I started building this control I did it all (as I was taught) in the RenderContents(HtmlTextWriter output) function.

The problem was that when it got to the point where the Telerik controls were being Rendered, they liked to throw some ReferenceNullExceptions my way.

After some looking around though I found an article in the Telerik Knowledge Base that said that I should add the Telerik controls in the CreateChildControls() function, so I did, and it works.

Check out the article here

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s