Monday 22 December 2014

  1. Display Calendar view using SharePoint in C# script.


  2. <script type="text/c#" runat="server">  
  3.   
  4. string strListName = "Courses";  
  5.  string strView = "All Items";  
  6. protected void Page_Load(object sender, EventArgs e)  
  7. {  
  8.     GenerateListViewWp();  
  9. }  
  10. void btnview_Click(object sender, EventArgs e)  
  11. {  
  12.          
  13.               
  14.              string strTitle = "Course Calendar";  
  15.            
  16.              SPWeb oWeb = SPContext.Current.Web;  
  17.              SPList oList = oWeb.Lists[strListName];  
  18.              SPView View = oList.Views[strView];  
  19.               ListViewWebPart wp = new ListViewWebPart();  
  20.              wp.ListName = oList.ID.ToString("B").ToUpper();  
  21.              wp.ViewGuid = oList.Views[View].ID.ToString("B").ToUpper();  
  22.              wp.ID = this.ID + "child";  
  23.              ////wp.Title = "";  
  24.              wp.ViewType = ViewType.Calendar;  
  25.           wp.GetDesignTimeHtml();  
  26.     this.PageCalendarDiv.Controls.Add(wp);  
  27.      
  28.    }  
  29.      
  30.    }  
  31.    </script>  
  32.     
  33.      
  34.    <div id="PageCalendarDiv" runat="server">  
  35.    </div>  

Using SharePoint Designer in Data View Web Part using the people picker with multiple names Display


  1. <script type="text/javascript">  
  2.   
  3.      function CleanNames(textclean) {  
  4.   
  5.           return text2clean.replace(/[;#0-9]+/g, "; ");  
  6.   
  7.      }  
  8.   
  9. </script>  
  10.   
  11.   
  12.   
  13. Then call it from your XSL  
  14.   
  15.   
  16.   
  17. <xsl:if test="string-length(@Employess) != 0">   
  18.   
  19.      <script type="text/javascript">document.write(CleanNames("<xsl:value-of select="@Employess" />"));</script>   
  20.   
  21. </xsl:if>  

No comments:

Post a Comment