/// <summary> /// Binds data to basic repeater. /// </summary> protected void BindData() { // Dataset = connects repeater with data source if (UseClassicDataset) { BasicRepeater.DataSource = SPDataSource.DataSource; if (!DataHelper.DataSourceIsEmpty(BasicRepeater.DataSource)) { // Set proper transformations LoadTransformations(); BasicRepeater.DataBind(); } } // XSLT else { XmlNode caml = SPDataSource.DataSource as XmlNode; string transName = TransformationName; // If selected item is set if (SPDataSource.IsSelected && !String.IsNullOrEmpty(SelectedItemTransformationName)) { transName = SelectedItemTransformationName; } // Get transformation info TransformationInfo ti = TransformationInfoProvider.GetTransformation(transName); if ((caml != null) && (ti != null)) { // Check it is XSLT transformation if (ti.TransformationType != TransformationTypeEnum.Xslt) { DisplayError(string.Format(GetString("sharepoint.XSL"), ti.TransformationFullName)); return; } try { ltlTransformedOutput.Text = SharePointFunctions.TransformCAML(caml, ti); } catch (Exception ex) { // Show error DisplayError(string.Format(GetString("sharepoint.XSLTError") + ResHelper.Colon + " " + ex.Message)); DisplayError("XSLT error: " + ex.Message); } } } }
/// <summary> /// OnPreRender override. /// </summary> protected override void OnPreRender(EventArgs e) { if (!string.IsNullOrEmpty(SPDataSource.ErrorMessage)) { // Show error and hide other controls DisplayError(SPDataSource.ErrorMessage); plcDataset.Visible = false; plcXSLT.Visible = false; pagerElem.Visible = false; } else { //DataSet if (UseClassicDataset) { if (HideControlForZeroRows && !BasicRepeater.HasData()) { Visible = false; } } // XSLT else { if (!SPDataSource.HasData) { // Hide or display zero rows message if (HideControlForZeroRows) { Visible = false; } else { Label lblZeroRowsText = new Label(); lblZeroRowsText.Text = ZeroRowsText; Controls.Add(lblZeroRowsText); } } } } base.OnPreRender(e); }
/// <summary> /// Reload data. /// </summary> public override void ReloadData() { base.ReloadData(); SetupControl(); BasicRepeater.ReloadData(true); }