需要遍历数据结构来动态生成webpart,代码如下:
WebPartManager mgr = WebPartManager1;
                    Label text= new Label();
                    CreateAction(dt.Rows[i][0].ToString(), dt.Rows[i][2].ToString(), dt);//遍历生成内容的页面HTML标记
                    
                    text.Attributes["title"] = dt.Rows[i][2].ToString();//webpart部件的标题                    text.ID = "lbl" + dt.Rows[i][0].ToString();                   text.Text = nodeHtml;
                   //Response.Write(text.Text);//页面能正常显示出来
                    GenericWebPart calWebPart = mgr.CreateWebPart(text);
                    calWebPart.ID = "cwp" + dt.Rows[i][0].ToString();
                    mgr.AddWebPart(calWebPart, WebPartZone2, 0);
面在效果是,页面上有标题,但没内容,Response.Write(text.Text);
的时候都能显示到页面上...
有没朋友做过这方面的东东,
给个解决方案一下.