我想把gridView状态保持,所以转换了下,如下
StringBuilder sb = new StringBuilder();
StringWriter sw = new StringWriter(sb);
HtmlTextWriter htw = new HtmlTextWriter(sw);
gridView1.RenderControl(htw);
ViewState["GridView"] = sw.ToString();
但是,我不知道又怎么把这个string转成GridView呢?
Control control=ParseControl(ViewState["GridView"].ToString());
gridView1 = control as GridView;