SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have created visual webpart in SharePoint 2010 which will generate class file for class derived from Webpart and second for UserControl. Now I have TabStrip Control on .ascx markup. Now I want to add tab in Tabstrip control only once so how can check for Ispostback in userControl ?

protected void Page_Load(object sender, EventArgs e) {

            if (!this.IsPostBack) {


I have used above code this work but once I add webpart I don't see tabs in design mode and then I refresh page again I can see tabs.

Please advise

share|improve this question
Have you placed a break point in there to confirm that you are definitely not getting into your if statement? – Abe Miessler Jul 18 '12 at 16:36
Is it only in the postback where you add the webpart it's missing or whenever it's in design mode? The first is expected with this code – Per Jakobsen Jul 18 '12 at 16:52
Thanks Abe for your quick reply.yes i did and i am not getting to code in if statement if i add webpart to webpartzone but once go back to page and refresh i can see tabs i am sure i am missing some lifecycle of events here but dont know – Ronak Jul 18 '12 at 16:53
Thanks Per It is missing when i add webpart and after then if i edit page again i can see tabs. – Ronak Jul 18 '12 at 16:54

Use (!this.Page.IsPostBack) in Sharepoint

share|improve this answer

Your Answer


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.