Guerilla SharePoint Designer Tips and Tricks

Bryan Phillips and Jason Graham Composable Systems, LLC http://bphillips76.spaces.live.com http://jasonAgraham.spaces.live.com  Sites  Contain all your content.  Lists  Store table-like data.  Document Libraries  Store documents.  SharePoint Designer  The tool to use for advanced customization. Meant for power users, but EVERY developer needs to know how to use it.  Combination of files stored on the web server's file system and files stored in the SharePoint content database.   Setup Lists Pages Document Library  Versioning  Approval  Pages Document Library  Versioning – Like source control. Keeps configurable number of versions.  Approval – Prevents documents from being viewed before someone can review and approve them. This includes ASPX pages too.  Watch out for this GOTCHA:  Using SPD, create custom pages in the List folder that you are working with, then move them into the Pages doc lib  We have found that the FormView (discussed later) will only generate controls for the doc lib and not the list you are binding to  How to Create a Page  In SPD, right click on List folder and go to New > ASPX  Add @ Registers:  <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>  <%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>  <%@ Import Namespace="Microsoft.SharePoint" %>  <%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>  Combination of Controls  ASP.Net Controls  SharePoint Controls  Usually CRUD, but doesn't have to be   What makes a custom SharePoint page work? There are many options, but here is what we do:  SharePoint:SPDataSource  To bind the Form to Lists  asp:FormView  To display Data and create Controls on the form  One Gotcha for custom SharePoint Pages:  You may see an error that says, "The security validation for this page is invalid" on pages not using default.master IF Web Page Security is turned ON  To fix this, add a after the form tag    Gives functionality for Adding, Updating, Deleting, and Reading SharePoint List Items Can be added from the "Data Source Library" Pane Important Attributes:  DataSourceMode  First, use "ListItem" to generate the fields.  Finally, use "List" to avoid errors.  SelectCommand  Can enter CAML with "CDATA" tags or HTML encoded text  U2U CAML Builder – For your own sanity's sake, do NOT create CAML without it.  Parameters  Select, Insert, Update, Delete  All have tags in them  Important Attributes  Name = "ListName"  DefaultValue = "The Actual List Name" DefaultValue="JobDescriptions"/> DefaultValue="JobDescriptions"/> DefaultValue="JobDescriptions"/> DefaultValue="JobDescriptions"/>  Generates ASP.Net controls for each of the fields in your list.  Delete the ones you don't need    Automatically sets up bindings to list fields Controls can be moved around as necessary *within* their parent Template tag. Important Attributes  DataSourceID = The ID of the SPDataSource  DefaultMode = Edit, Insert, or ReadOnly   Automatically generates three templates:  InsertItemTemplate (Insert)  EditItemTemplate (Edit)  ItemTemplate (ReadOnly) Generates asp:TextBox for every field (except in ReadOnly mode)—change the type of control as needed < InsertItemTemplate> YOUR CONTROLS GO HERE, INCLUDING SAVE BUTTONS  Create ASP.Net Page     asp:Button – At least one needed to save the user's data. asp:DropDownList, asp:ListBox etc… SharePoint:FormField – Use to display SharePoint control templates (e.g. PeoplePicker). Validation Controls – Validate your user data or SharePoint WILL throw an exception.  Important Attributes:  CommandName = Insert, Update, or Delete  CausesValidation = true or false  Redirecting the browser  You have to redirect the browser yourself or your form will simply reload after updating the list  At least Two ways:  JavaScript  Use "Source" Query String variable, if you will always control access to the URL of the page   Can be populated from another list to act as a "lookup" Important Attributes  DataSourceID = The SPDataSource used to populate the DropDownList/ListBox  DataTextField = The field to pull the text from  DataValueField = The field to pull the value from (ID)  SelectedValue='<%# Bind("FieldName") %>'  The SPDataSource that the FormField is bound to controls the List that will receive the info  Generates difficult SharePoint controls for you  People Pickers  Rich Text Controls  Important Attributes:     FieldName = Which field to generate a control for ControlMode = Options are New, Edit, and Display ListId = GUID for the list that the field is located in Value='<%# Bind("FieldName") %>'  CSS Styles  May not appear as expected  Tools to find CSS Styles:  IE Developer Toolbar – (Built into IE 8)  Firebug – (Plug-in for FireFox, Lite version for IE, Opera)  Generate multiple HTML Controls  View HTML to get true control names for validation and JavaScript manipulation    Asp:RequiredFieldValidator Asp:ValidationSummary The "ValidationGroup" attribute    Marks a control for validation One for each control to validate Important Attributes:  ControlToValidate = Name of Control  ErrorMessage = Message displayed in ValidationSummary  Text = Message to be displayed where RequiredFieldValidator exists  ValidationGroup = Name of Validation Group    Displays validation info to user (error messages) One for each ValidationGroup Important Attributes:  HeaderText = Text to be displayed above error messages  DisplayMode = BulletList (Default), List, SingleParagraph  EnableClientScript  True—renders client side script to update this control  False—allows it to only update on a round trip to the server  ValidationGroup = The name of the ValidationGroup  FINALLY: On the button that you are using to Insert or Edit with: Include an attribute for ValidationGroup="MyGroup"  Adding Validation    DEMO if time permits Could be a talk all on its own Utilize the "IF" conditional branches to avoid infinite loops  Bryan Phillips  http://bphillips76.spaces.live.com  Jason Graham  http://jasonAgraham.spaces.live.com  Composable Systems, LLC  www.ComposableSystems.net

Related docs
guerilla's guide to wbr evidence
Views: 9  |  Downloads: 5
Guerilla Marketing vs Big Bucks1558
Views: 0  |  Downloads: 0
guerilla-marketing-tactics
Views: 4  |  Downloads: 1
guerilla-marketing-tactics
Views: 18  |  Downloads: 6
guerilla-marketing-tactics free report
Views: 163  |  Downloads: 14
Guerilla Books
Views: 7  |  Downloads: 1
Guerilla Marketing
Views: 310  |  Downloads: 32
Guerilla
Views: 4  |  Downloads: 0
Job Search First 90 days Tips Tricks
Views: 0  |  Downloads: 0
guerilla marketing tactics
Views: 370  |  Downloads: 28
guerilla marketing examples
Views: 1443  |  Downloads: 68
definition guerilla marketing
Views: 112  |  Downloads: 19
premium docs
Other docs by brittanymorse
Board Resolution approving equipment lease
Views: 234  |  Downloads: 4
Articles of Incorporation California
Views: 359  |  Downloads: 8
Notice of Directors Meeting
Views: 131  |  Downloads: 1
giles-all
Views: 493  |  Downloads: 8
General Dynamics Corp Ammendments and Bylaws
Views: 167  |  Downloads: 0
KB Home Ammendments and Bylaws
Views: 165  |  Downloads: 0
Planand Agreement of Merger Between N and N
Views: 219  |  Downloads: 6
Hypnosis Studies on weight loss
Views: 847  |  Downloads: 9
Dirty Joke Trust
Views: 832  |  Downloads: 15
adopt200
Views: 87  |  Downloads: 0
Board Resolution Declaring Stock Dividend
Views: 212  |  Downloads: 2