Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a stock chart and some other controls in my SharePoint WebPart...

I am unable to call all the controls in the WebPart, only one control displayed in the WebPart or the ASP server controls rendered as a object. For example Label control is rendered as System.Web.UI.WebControls.Label but the actual Label control is not displaying.

Please give me the approach to overcome this problem.

Thanks, Bhanu

share|improve this question
1  
Are you able to post some source code tohelp us identify your issue? My bet is that you've not added the Label control to the this.Controls collection. –  James Love Feb 22 '11 at 14:05

2 Answers 2

Within your CreateChildControls(), it should have something like this:

Label x = new Label();
x.Text = "hello world";
this.Controls.Add(x);
share|improve this answer

What Andrew said, an in addition you could also add them to another panel to gain some div layout control:

Label x = new Label();
x.Text = "hello world";

Label y = new Label();
y.Text = "hello world2";

Panel panel = new Panel();
panel.CssClass = "my-panel";
panel.Controls.Add(x);
panel.Controls.Add(y);

this.Controls.Add(panel);

This is all going from memory, so you might need to tweak a couple things.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.