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 would like to create multiple tabs within a webpart using "Multiview". There are lot of examples available for creating tabs using "Multiview" or "TabControl" but that were in asp.net pages.

So I would like to do the same in webpart, so please suggest how to achieve that functionality.

I have tried the following, it executed but nothing can be viewed inside the web part.

protected override void CreateChildControls()
{
  Label lblname = new Label();

  lblname.Text = "testlabel";

  MultiView multiMain = new MultiView();

  View view1 = new View();
  view1.Controls.Add(lblname);

  multiMain.Views.Add(view1);

}

Cheers,

Chandra Shekhar

share|improve this question

1 Answer 1

First thing in the above code i observed. You are not adding the controls to Controls collection

this.Controls.Add(yourcreatedcontrol);

Then only the webpart can render your controls

share|improve this answer
    
Hello, Thanks for your reply. So you mean to say that I need to add "this.Controls.Add(multiMain);" at the end? Please suggest –  Chandra Shekhar Aug 4 '11 at 6:07
    
Yes, that will do. –  Anita Boerboom Aug 4 '11 at 16:39

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.