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 created a webpart with an SPGrid that is created after an onclick event. The grid displays with an "Edit" Button. When I click on the edit button it causes a postback and the grid disappears. How can I change the

share|improve this question
    
Could you paste the whole web part code here? –  Falak Mahmood Jun 7 '12 at 22:48
add comment

1 Answer

I hope you're calling the code in right order.

   protected override void CreateChildControls()
    {

       // you code here

       Controls.Add(yourgridviewid);

       //Important to call this after Control.Add...

       yourgridviewid.PagerTemplate = null;
       base.CreateChildControls();
    }
share|improve this answer
    
I solved the issue. I was adding the control on a button_click event which was causing a postback and I didn't include the grid on the postback. Thank you for your help. –  user8746 Jun 8 '12 at 17:17
add comment

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.