I am trying to add Web parts dynamically which works. Problem is the Text property for control (I am adding Button) is not seen. (I have taken Button control here to make the example simple, in my real code I am adding a user control which contains a label and I observe same problem there)
Main part of the code is given here:
WebPartManager1.DisplayMode =
WebPartManager.DesignDisplayMode;Button b = new Button();
string id = string.Format("Button{0}{1}{2}", DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second); //some "unique" id
b.ID = id;
b.Text = "The text does not get displayed";
GenericWebPart webPart = WebPartManager1.CreateWebPart(b);
WebPartManager1.AddWebPart(webPart, WebPartZone1, 0);
The button does get added in WebPartZone1 but the text on button is missing. Can anyone help?
Thanks in advance,
Sandeep
http://www.dotnetic.com