0

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

  • 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
1

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

Label x = new Label();
x.Text = "hello world";
this.Controls.Add(x);
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy