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 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();
}
-
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