Display Calendar view using sharepoint in C# script.

Sagarp
Posted by Sagarp under Others category on | Points: 40 | Views : 6820
<script type="text/c#" runat="server">

string strListName = "Courses";
string strView = "All Items";
protected void Page_Load(object sender, EventArgs e)
{
GenerateListViewWp();
}
void btnview_Click(object sender, EventArgs e)
{


string strTitle = "Course Calendar";

SPWeb oWeb = SPContext.Current.Web;
SPList oList = oWeb.Lists[strListName];
SPView View = oList.Views[strView];
ListViewWebPart wp = new ListViewWebPart();
wp.ListName = oList.ID.ToString("B").ToUpper();
wp.ViewGuid = oList.Views[View].ID.ToString("B").ToUpper();
wp.ID = this.ID + "child";
////wp.Title = "";
wp.ViewType = ViewType.Calendar;
wp.GetDesignTimeHtml();
this.PageCalendarDiv.Controls.Add(wp);

}

}
</script>


<div id="PageCalendarDiv" runat="server">
</div>

Comments or Responses

Login to post response