示例#1
0
    /// <summary>
    /// Gets and bulk updates web part containers. Called when the "Get and bulk update containers" button is pressed.
    /// Expects the CreateWebPartContainer method to be run first.
    /// </summary>
    private bool GetAndBulkUpdateWebPartContainers()
    {
        // Prepare the parameters
        string where = "ContainerName LIKE N'MyNewContainer%'";
        string orderBy = "";
        int    topN    = 0;
        string columns = "";

        // Get the data
        DataSet containers = WebPartContainerInfoProvider.GetContainers(where, orderBy, topN, columns);

        if (!DataHelper.DataSourceIsEmpty(containers))
        {
            // Loop through the individual items
            foreach (DataRow containerDr in containers.Tables[0].Rows)
            {
                // Create object from DataRow
                WebPartContainerInfo modifyContainer = new WebPartContainerInfo(containerDr);

                // Update the properties
                modifyContainer.ContainerDisplayName = modifyContainer.ContainerDisplayName.ToUpper();

                // Save the changes
                WebPartContainerInfoProvider.SetWebPartContainerInfo(modifyContainer);
            }

            return(true);
        }

        return(false);
    }