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

  • Could you paste the whole web part code here? – Falak Mahmood Jun 7 '12 at 22:48
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();
    }
  • 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. – Walter Johnson Jun 8 '12 at 17:17

Your Answer

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

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