0

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

1
  • Could you paste the whole web part code here? Commented Jun 7, 2012 at 22:48

1 Answer 1

1

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();
    }
1
  • 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. Commented Jun 8, 2012 at 17:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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