i have a really simple question and probably hard answer.
i want to add webpartzone into my sharepoint page using c# code, how can i do that?
i search all of web and found nothing.
what i did is: i create visual web part project and added this code to page_init event of it:
protected void Page_Init(object sender, EventArgs e)
{
WebPartZone webPartZone1 = new WebPartZone();
webPartZone1.AllowLayoutChange = true;
webPartZone1.EmptyZoneText = "No Data are provided";
webPartZone1.Enabled = true;
webPartZone1.HeaderText = "My Custom Zone";
webPartZone1.Visible = true;
this.Page.Controls.Add(webPartZone1);
}
and it's doesn't work. but can give you some idea of what i want. im really confused. could anyone help. thanks anyway.