Question

In the SP system I'm maintaining I have an aspx page that contains a DataFormWebPart on it. I wanted to make some wording changes in a javascript alert on the page with no real functional changes. I made a copy of it, made my changes, compared the original and copy and noticed that the "ViewFlag" property was changed from "8" in the original to "1048584". The copy I made still has the value "8".

<WebPartPages:DataFormWebPart runat="server" EnableOriginalValue="False" DisplayName="My Forms" ViewFlag="1048584"... />

My google-fu (or bing-fu in my case) must be weak because I can't find what the property "ViewFlag" property means/represents/does or what any of the values themselves (8, 1048584, etc.) mean. Is there documentation on this somewhere?

Jeff

Was it helpful?

Solution

DataFormWebPart.ViewFlags property gets or sets the type of content to be displayed by the DataFormWebPart. The DataFormWebPart.ViewFlags property return type is SPViewFlags enumeration that describes the view type of a Web Part:

[System.Flags]
[SubsetCallableType]
public enum SPViewFlags : long
{
   None = 0L,
   Html = 1L,
   ClientModified = 2L,
   TabularView = 4L,
   Hidden = 8L,
   LockWeb = 16L,
   ReadOnly = 32L,
   FailIfEmpty = 64L,
   FreeForm = 128L,
   FileDialog = 256L,
   FileDialogTemplates = 512L,
   AggregationView = 1024L,
   Grid = 2048L,
   Recursive = 4096L,
   RecurrenceRowset = 8192L,
   Contributor = 16384L,
   Moderator = 32768L,
   Threaded = 65536L,
   Chart = 131072L,
   Personal = 262144L,
   Calendar = 524288L,
   Default = 1048576L,
   FilesOnly = 2097152L,
   Ordered = 4194304L,
   Mobile = 8388608L,
   DefaultMobile = 16777216L,
   IncludeVersions = 33554432L,
   Gantt = 67108864L,
   IncludeRootFolder = 134217728L,
   DefaultViewForContentType = 268435456L,
   HideUnapproved = 536870912L,
   RequiresClientIntegration = 1073741824L,
   Unknown = 2147483648L,
}

How to determine what value DataFormWebPart.ViewFlag property represents?

You could use the following example to convert the DataFormWebPart.ViewFlags value into user-friendly format:

const long flagValue = 1048584L;
foreach (long value in Enum.GetValues(typeof(SPViewFlags)))
{
    if ((flagValue & value) != 0)
    {
        var flagName = Enum.GetName(typeof (SPViewFlags), value);
        Console.WriteLine(flagName);
    }            
}

Result

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top