Tuesday 22 January 2013

SPQUERY with More details



View Complete blog at MSDN site .URl:-http://msdn.microsoft.com/en-us/library/ms438338.aspx
<View
  AggregateView = "TRUE" | "FALSE"
  BaseViewID = "Integer"
  ContentTypeID = "Text"  CssStyleSheet = "Text"
  DefaultView = "TRUE" | "FALSE"
  DefaultViewForContentType = "TRUE" | "FALSE"
  DisplayName = "Text"
  FailIfEmpty = "TRUE" | "FALSE"
  FileDialog = "TRUE" | "FALSE"
  FPModified = "TRUE" | "FALSE"
  FreeForm = "TRUE" | "FALSE"
  Hidden = "TRUE" | "FALSE"
  ImageUrl = "Text"
  IncludeRootFolder = "TRUE" | "FALSE"
  List = "Integer" | "Text"
  MobileDefaultView = "TRUE" | "FALSE"  MobileItemLimit = "Integer"  MobileUrl = "Text"
  MobileView = "TRUE" | "FALSE"
  ModerationType = "Text"
  Name = "Text"
  OrderedView = "TRUE" | "FALSE"
  PageType = "Text"
  Path = "Text"
  ReadOnly = "TRUE" | "FALSE"
  RecurrenceRowset = "TRUE" | "FALSE"
  ReqAuth = "TRUE" | "FALSE"
  RequiresClientIntegration = "TRUE" | "FALSE"
  RowLimit = "Integer"
  Scope = "Text"
  SetupPath = "Text"
  ShowHeaderUI = "TRUE" | "FALSE"  TabularView = "TRUE" | "FALSE"
  TargetId = "Text"
  TargetType = "List" | "ContentType"
  Threaded = "TRUE" | "FALSE"
  ToolbarTemplate = "Text"
  Type = "HTML" | "Chart" | "Pivot"
  Url = "Text"
  WebPartOrder = "Integer"
  WebPartZoneID = "Text">
</View>
Attribute
Description
AggregateView
Optional BooleanTRUE to specify that the view is a Merge Forms view used in an XML Form library. By default, an XML Form library has a Merge Forms view that is initially hidden. When an XML editor is used to publish an XML Form Properties (XFP) file to the Forms directory of the library, along with a template used by the editor, theAggregateView attribute identifies the Merge Forms view. This view can be made visible or hidden, depending on whether the list template or definition for the library supports data merging.
BaseViewID
Optional Integer. Specifies the ID of the base view.
ContentTypeID
Optional Text. Specifies the ID of the content type with which the view is associated.
CssStyleSheet
Optional Text.
DefaultView
Optional BooleanTRUE to specify that the view is the default view.
DefaultViewForContentType
Optional BooleanTRUE to specify that the view is the default view for a content type.
DisplayName
Optional Text. Specifies the name of the view that is displayed on the Quick Launch bar.
FailIfEmpty
Optional Boolean. If the view returns no items, TRUE to return a blank page and an HTTP error code instead of rendering the ViewEmpty element. Used for programmatic manipulation of views from a client application, so that the client application will not have to parse a document in order to discover whether the view is empty.
FileDialog
Optional BooleanTRUE to specify that the view is displayed in file dialog boxes for applications that are used within the context of SharePoint Foundation, and that parse the output HTML to determine the contents of the list.
FPModified
Optional BooleanTRUE if the view has been altered through editing in a Web page editor, and the view is no longer customizable by the SharePoint Foundation user interface (UI).
FreeForm
Optional BooleanTRUE to specify alternate field formatting for certain field types when fields are rendered. In particular, this attribute affects the alignment of number columns, which is particularly useful in custom nontabular view types.
Hidden
Optional BooleanTRUE to hide the view.
ImageUrl
Optional Text. Specifies the server-relative URL for the image that is displayed in the title area of the list view, for example, /_layouts/images/pgrpicon.png.
IncludeRootFolder
Optional BooleanTRUE to specify that the root folder is returned in the list view.
List
Optional Integer or Text. Specifies the type of list. This value can be either the ID of the template for a list (an integer), or the URL to a list provisioned in the site (a string). Best practice is to use Text, because Integer might not be specific enough (e.g., if there are two announcements lists in the site and you specify List=104).
MobileDefaultView
Optional BooleanTRUE to specify that the standard SharePoint list view is the default mobile view. Only one view per list can be designated as the default mobile view.
MobileItemLimit
Optional Integer.
MobileUrl
Optional Text.
MobileView
Optional BooleanTRUE to specify that the standard SharePoint list view is also a mobile view. This attribute does not apply to Calendar, Datasheet, or Gantt views.
ModerationType
Optional Text. Specifies the Content Approval type, which can be HideUnapproved,Contributor, or Moderator. The HideUnapproved view hides unapproved draft items from users who only have permission to read items. The Contributor view shows the pending and rejected items for the current user. The Moderator view is accessible only to users who have managed list permissions and shows the pending and rejected items for all users.
Name
Optional Text. The name given to the view; used to select a different named view in the UI as well as to refer to a named view when specifying a filter for a Lookup field.
OrderedView
Optional BooleanTRUE to specify that the view is ordered.
PageType
Optional Text. Specifies the type of form in which the view is used. Possible values include the following:
  • DEFAULTVIEW   Default view.
  • DIALOGVIEW   File dialog box view.
  • DISPLAYFORM   Display form for list items.
  • DISPLAYFORMDIALOG   Display form for a file dialog box.
  • EDITFORM   Edit form for list items.
  • EDITFORMDIALOG   Edit form for a file dialog box.
  • INVALID   Not used.
  • MAXITEMS   Not used.
  • NEWFORM   New form for list items.
  • NEWFORMDIALOG   New form for a file dialog box.
  • NORMALVIEW   Normal view.
  • SOLUTIONFORM   Solution form.
  • VIEW   View, including both default view and normal view.
Path
Optional Text. Specifies the file name for the view.
ReadOnly
Optional BooleanTRUE to make the view read-only.
RecurrenceRowset
Optional BooleanTRUE to expand recurring events in the view and display each instance of each recurring event. The default value is FALSE.
ReqAuth
Optional Boolean.
RequiresClientIntegration
Optional BooleanTRUE to use features that launch client applications; otherwise, users must work on documents locally and upload changes. 
RowLimit
Optional Integer. Applies to the HTML view type only. Specifies the maximum number of rows to render on any one page. When the row limit is exceeded, the Next andPrevious buttons allow all of the returned recordset to be viewed.
If RowLimit is not specified, the default number of Rows returned is 50. If "None" is specified for the view type, all the rows of the recordset are returned in one view.
When a view is rendered, the render variables ViewHasNext and ViewHasPrev are set toTRUE or FALSE, based on whether the current view has reached the row limit from the dataset. These variables can be used in successive page definitions to render Next andPrevious buttons on the page, as in the following example:
<Switch>
  <Expr><GetVar Name=”ViewHasPrev”/></Expr>
  <Case Value=”TRUE”>
    <![CDATA[...Previous button defined here... ]]>
  </Case>
</Switch>
The variables NextPageURL and PrevPageURL are also set to nonblank values when there is forward or backward paging content from the current display. These variables can be used by constructing the Next and Previous buttons so that they have the correct URL to access the next page of content.
Scope
Optional Text. Specifies the recursive scope for a view of a document library. Possible values include the following:
  • FilesOnly—Show only the files of a specific folder.
  • Recursive—Show all files of all folders.
  • RecursiveAll—Show all files and all subfolders of all folders.
If this attribute is not set, the view displays only the files and subfolders of a specific folder. The value of this attribute corresponds to the Scope property of the SPView class.
SetupPath
Optional Text. Specifies the site-relative path to the folder in the setup directory that contains the .aspx page for the view, for example, pages\viewpage.aspx.
ShowHeaderUI
Optional BooleanFALSE to render all FieldRef elements used in the header display mode without decorating the UI with HTML. In other words, when this mode is set, the UI does not provide sorting and filtering as hyperlinks in the column header. The default value is TRUE.
TabularView
Optional Boolean.
TargetId
Optional Text.
TargetType
Optional Text. Possible values include List and ContentType.
Threaded
Optional BooleanTRUE to apply inner grouping in the view. A threaded view is constructed based on the built-in threading column (assumed to exist for the list). The view is sorted on this field as the secondary sort. If other columns in the view are specified as sorted or grouped, those rules are applied before the threading column sort order. As a result, all discussions grouped by a topic can be collected together, and the message threading can be displayed beneath the collection.
When TRUE, the RowLimit element has a different meaning when used on a threaded discussion board list view. Instead of specifying the number of items to return, it specifies the number of discussion threads to return, where a thread could consist of one or more items. In addition to having the Threaded attribute set to TRUE, a threaded view must be sorted by the thread ID; otherwise, this row limit behavior does not take effect.
ToolbarTemplate
Optional Text. Specifies the name of the predefined toolbar template that is used for the view toolbar.
Type
Optional Text. Specifies the rendering type of the view. The type is the common enumerated HTML view and can be set to HTMLChart, or Pivot.
Url
Optional Text. Specifies the URL for the view.
WebPartOrder
Optional Integer. Specifies the vertical positioning of the Web Part within a zone.
WebPartZoneID
Optional Text. Specifies the zone for the Web Part.

Monday 14 January 2013

SharePoint jQuery Form validation


In this example we are going to use jQuery validation plugin to validate a SharePoint page. We are going to load all jQuery validation files from web (some from Google CDN and some from Microsoft AJAX CDN).
In order to test this example you have to create a new Visual Web Part and place the snippet bellow to your ascx file.












<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/
jquery.validate/1.7/jquery.validate.js"></script>
<link rel="stylesheet" type="text/css" media="screen" href="http://ajax.aspnetcdn.com/ajax/
jquery.ui/1.8.5/themes/cupertino/jquery-ui.css" />
<link rel="stylesheet" type="text/css" media="screen" href="http://jquery-ui.googlecode.com/svn/branches/dev/themes/base/ui.button.css" />
<script type="text/javascript" src="http://jquery-ui.googlecode.com/svn/tags/latest/ui/jquery.ui.widget.js"></script>
<script type="text/javascript" src="http://jquery-ui.googlecode.com/svn/tags/latest/ui/jquery.ui.button.js"></script>

<script type="text/javascript">
$.validator.setDefaults({
    highlight: function (input) {
        $(input).addClass("ui-state-highlight");
    },
    unhighlight: function (input) {
        $(input).removeClass("ui-state-highlight");
    },
    success: function (input) {
        $(input).addClass("valid").text("Ok");
    }
});

$(document).ready(function () {
    $("#aspnetForm").validate({
        rules: {
            <%=txtUsername.UniqueID %>: {
                required: true,
                minlength: 4
                },
            <%=txtEmail.UniqueID %>: {
                required: true,
                email: true
            },
            <%=txtConfirmEmail.UniqueID %>: {
                    required: true,
                email: true,
                    equalTo: "#<%=txtEmail.ClientID %>"
                },
            <%=txtPassword.UniqueID %>: {
                required: true,
                minlength: 3
            },
            <%=txtConfirmPassword.UniqueID %>: {
                    required: true,
                minlength: 3,
                    equalTo: "#<%=txtPassword.ClientID %>"
                }
        }
    })
});
</script>

<style type="text/css">
    .error { color: red; }
    .valid { color: green; }
</style>

<table class="ui-widget ui-widget-content ui-corner-all">
    <tr>
        <td colspan="2"><div class="ui-widget ui-widget-header ui-corner-all">Create new account</div></td>
    </tr>
    <tr>
        <td width="160px">Username:</td>
        <td><asp:TextBox runat="server" ID="txtUsername" CssClass="required ui-widget-content" /></td>
    </tr>
    <tr>
        <td>Password:</td>
        <td><asp:TextBox runat="server" TextMode="Password" ID="txtPassword" CssClass="required ui-widget-content" /></td>
    </tr>
    <tr>
        <td>Confirm password:</td>
        <td><asp:TextBox runat="server" TextMode="Password" ID="txtConfirmPassword" CssClass="required ui-widget-content" /></td>
    </tr>
    <tr>
        <td>Email:</td>
        <td><asp:TextBox runat="server" ID="txtEmail" CssClass="required email ui-widget-content" /></td>
    </tr>
    <tr>
        <td>Confirm email: <font style="color:#999">*</font></td>
        <td>
            <asp:TextBox runat="server" ID="txtConfirmEmail" CssClass="required email ui-widget-content" />
            <div class="err_container"></div>
        </td>
    </tr>
    <tr>
        <td></td>
        <td>
            <asp:Button runat="server" ID="btnSend" Text="Create!" CssClass="submit ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" OnClick="SendClick" />
        </td>
    </tr>
</table>




You will notice a strange behavior: if you try to submit a page that is not valid, next atempts will not submit even if the page is now valid. The code in Page_Load will fix this jQuery validation issue.

protected void Page_Load(object sender, EventArgs e)
{
    string jQueryFix = "if ($('#aspnetForm').valid()) { " +
        Page.ClientScript.GetPostBackEventReference(btnSend, "") +
        "; return true; } else { return false; }";

    btnSend.Attributes.Add(
        "onclick",
        jQueryFix);
}

protected void SendClick(object sender, EventArgs e)
{
}


Referred from Here