Learn more about SQL Server tools

mssqltips logo
 

Tutorials          DBA          Dev          BI          Career          Categories          Webcasts          Whitepapers          Today's Tip          Join

Tutorials      DBA      Dev      BI      Categories      Webcasts

DBA    Dev    BI    Categories

Next Webcast - Simple SQL Server Reporting - Click Here to Register
 

Reusable code snippet via SharePoint Designer


By:   |   Read Comments   |   Related Tips: > Sharepoint

Problem

One of the restrictions and limitations of SharePoint Designer 2007 was that we can't save our scripts to be reusable for the entire site. But with SharePoint Designer 2010 we'll see how to create a reusable - code/script snippet.

Solution

Code snippets are pre-defined blocks of code / html. We can use a snippet to enter a short block quickly and easily - just as we do in Visual Studio. Let's follow up the steps below to create a reusable - code/script snippet via SharePoint Designer 2010:

- Click on "Start" -> SharePoint -> Microsoft SharePoint Designer 2010 :

windows update

- Click "Sites" -> Open Site: Type your site URL -> Open:

open site

- Click on "All Files" under the "Navigation" Section, then double click "SitePages":

site pages

-Right click on the "Home.aspx" page, then select "Check Out":

check out

- Then right click again on "Home.aspx" and select "Edit File in Advanced Mode":

edit file in advanced mode

- Click on the "Create" button under "Edit" (Ribbon Menu Items):

create

- Type a "Keyword" value (ex: "Alert-Script") and "Description", then add your code/script below as seen:

alert script

- Then go to your page and open HTML code then click on "Show" button under "Edit" (Ribbon Menu Items) and select the created keyword "Alert-Script":;:

show
alert script

- Here's the code/script snippet inserted automatically after selecting the keyword "Alert-Script":

place holder

- Right click again on the "Home.aspx" page then select "Check In", then save:

check in
designer

- Now , Let's go to the "Home.aspx" page to check our script:

site actions
Next Steps


Last Update:


next webcast button


next tip button



About the author





Post a comment or let the author know this tip helped.

All comments are reviewed, so stay on subject or we may delete your comment. Note: your email address is not published. Required fields are marked with an asterisk (*).

*Name    *Email    Email me updates 


Signup for our newsletter
 I agree by submitting my data to receive communications, account updates and/or special offers about SQL Server from MSSQLTips and/or its Sponsors. I have read the privacy statement and understand I may unsubscribe at any time.



    



Learn more about SQL Server tools