/// <summary>
 /// Binds datasource control data to the viewer control
 /// </summary>
 private void BindControl()
 {
     if (DataSourceControl != null)
     {
         BasicDataList.DataSource = DataSourceControl.LoadData(true);
         LoadTransformations();
         BasicDataList.DataBind();
         binded = true;
     }
 }
Esempio n. 2
0
 /// <summary>
 /// OnPageChanged event handler.
 /// </summary>
 private void BasicDataList_OnPageChanged(object sender, EventArgs e)
 {
     // Reload data
     if (DataSourceControl != null)
     {
         BasicDataList.DataSource = DataSourceControl.DataSource;
         LoadTransformations();
         BasicDataList.DataBind();
         binded = true;
     }
 }
    /// <summary>
    /// Binds data to basic data list.
    /// </summary>
    protected void BindData()
    {
        // Dataset = connects DataList with data source
        if (UseClassicDataset)
        {
            // Connect data list with data source
            BasicDataList.DataSource = SPDataSource.DataSource;

            if (!DataHelper.DataSourceIsEmpty(BasicDataList.DataSource))
            {
                // Set proper transformations
                LoadTransformations();

                BasicDataList.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;
            }

            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));
                }
            }
        }
    }