tags:

views:

106

answers:

1

Hi there,

I am trying to get a c# server control which i have already built to use not only create child controls but also rendercontents. At the moment my control uses the rendercontents method to do some fucntions and transform xml using xslt. this works great, however i then wanted to add after this transformation a couple of textbox controls. When i do this the textbox controls do not show up in my servercontrol and only the transformation. I then stripped back my code to include the two methods and with just createchildcontrols method the controls appear however as soon as i use the rendercontents method it overwrites the controls and they dissapear.

can anyone please advise me how i should do this?

many thanks

Chris

A: 

Silly question, but did you remember to have your RenderContents method call base.RenderContents? (Or RenderChildren, whichever...)

Matt Bishop
this.EnsureChildControls(); ? this is called in my oninit..i am trying it now in my rendercontents method..
No, not EnsureChildControls; that's a different thing entirely. Your RenderContents method should be calling the base class RenderContents method; otherwise any controls you don't specifically render yourself won't get rendered at all.
Matt Bishop
ill try that then..ta
that has worked..now i am having the problem that i need to get the controls in createchildcontrols to render after the render contents.. so that my textboxes etc appear after my xslt transformation performed in rendercontents..any ideas?
That'll be something to do with the way you're constructing things in CreateChildControls, surely? Or it's to do with whether you call base.RenderContents before or after your custom code. It's hard to tell without seeing the code...
Matt Bishop