Thursday, October 28, 2010

Using Silver Light iN ASP.net

If you are going to use Silverlight into your ASP.NET website, you need to
add the reference of Silverlight.js file into your page (If you have master page,
better to add the reference into it so that you don't need to add the reference to all your .aspx pages).
Please note that the referecne of Silverlight should be placed
between and tag and your code should look like .
 Silverlight.js file can be found at this website too,
however we suggest to get the latest from Microsoft website.

Step - 2
You need to create a placeholder for your Silverlight content inside
 your tag where you want your Silverlight content to appear.
 In general, you should create a div html element and specify its
 id property like this

Step - 3
Write the JavaScript code to call the initialization function of Silverlight
object like this. You can write this code after your placeholder (Step-2).


Here I am passing all the required value as a parameter. In this case the
1st parameter is the placeholder that I created in the 2nd step,
2nd parameter is the width of the Silverlight plug-in area
3rd parameter is the height of the Silverlight plug-in area
4th parameter is the .xaml file that specifies the behavior of the Silverlight object

Step - 4
Write JavaScript function to initialize the Silverlight object.
In my case it looks like below. It can be placed inside the common
JavaScript file of your website. In any case, this code must be
 rendered to the browse before last step (Step - 3) code otherwise
browser may throw JavaScript error. Its always better to place this code between and .


function createSilverlightPlugin(placeHolder, width, height, xamlfile)
{
// Retrieve the div element you created in the previous step.
var parentElement = document.getElementById(placeHolder);
Silverlight.createObject
(
xamlfile, // Source property value.
parentElement, // DOM reference to hosting DIV tag.
placeHolder, // Unique plug-in ID value.
{ // Per-instance properties.
width:width, // Width of rectangular region of
// plug-in area in pixels.
height:height, // Height of rectangular region of
// plug-in area in pixels.
inplaceInstallPrompt:false, // Determines whether to display
// in-place install prompt if
// invalid version detected.
background:'#fecefe', // Background color of plug-in.
isWindowless:'false', // Determines whether to display plug-in
// in Windowless mode.
framerate:'24', // MaxFrameRate property value.
version:'1.0' // Silverlight version to use.
},
{
onError:null, // OnError property value --
// event handler function name.
onLoad:null // OnLoad property value --
// event handler function name.
},
null
); // Context value -- event handler function name.
}

Step - 5
Now, you have the placehoder object and function to
 initialize the Silverlight object. Its time to write the behavior
of the Silverlight object. So create a .xaml file and write
below code. Please note that you need to specify this file
path as a 4th parameter of Step - 3 initialization function.




Instead of writing above code into a separate .xaml file,
 you may write it into your .aspx page as well. In that
case your code should look like below.
Notice that if you have written the .xaml code into your .
aspx page, your Step - 3 code should be slightly changed as
below. Here, instead of specifying the .xaml file path in
the 4th parameter of initialization function, you need to
specify the id of the .xaml code preceeded by #.

Sharepoint Basics

      Create a site collection
1.   On the SharePoint Central Administration home page, click the Application Management tab on the top link bar.
2.   On the Application Management page, in the SharePoint Site Management section, click Create site collection.
3.   On the Create Site Collection page, in the Web Application section, select a Web application to host the site collection from the Web Application drop-down list.
4.   In the Title and Description section, type a title and description for the site collection.
5.   In the Web Site Address section, select a URL type (personal or sites), and then type a URL for the site collection.
6.   In the Template Selection section, select a template from the tabbed template control.
7.   In the Primary Site Collection Administrator section, specify the user account for the user you want to be the primary administrator for the site collection. You can also browse for the user account by clicking the Book icon to the right of the text box. You can check the user account by clicking the Check Names icon to the right of the text box.
8.   Optionally, in the Secondary Site Collection Administrator section, specify the user account for the user you want to be the secondary administrator for the site collection. You can also browse for the user account by clicking the Book icon to the right of the text box. You can check the user account by clicking the Check Names icon to the right of the text box.
9.   Click Create to create the site collection.

Create a SharePoint site
1.   On the SharePoint Central Administration home page, click the Application Management tab on the top link bar.
2.   On the Application Management page, in the SharePoint Site Management section, click Site collection list.
3.   On the Site Collection List page, in the URL column, click the URL for the site collection to which you want to add a site. The full URL path for the site collection appears in the URL box.
4.   Copy and paste the full URL path into your browser, and then, on the home page of the top-level site for the site collection, on the Site Actions menu, click Create.
5.   On the Create page, in the Web Pages section, click Sites and Workplaces.
6.   On the New SharePoint Site page, in the Title and Description section, type a title and description for the site.
7.   In the Web Site Address section, type a URL for the site.
8.   In the Template Selection section, select a template from the tabbed template control.
9.   Either change other settings, or click Create to create the site.
10.  The new site opens.