About Me

I am a Software Engineer presently working in Microsoft as vendor.The main aim of this blog is to Share my knowledge in Sharepoint,AZURE and Silverlight.

Saturday 14 June 2008

How to Integrate Silverlight in Smartpart.

can we integrate our smartpart with silverlight.(I say YES.)

People who are working with smartpart is in dilemma. how to use silverlight in smartparts then here is the solution jump and give a try.

This Post is continuation of my previous post so go through my previous post for creating silverlight webpart.

People who worked in asp.net feels uncomfort in sharepoint as we have to develop custom webpart from the scratch for them smart part is a good webpart which takes usercontrol and renders our usercontrol to webpart.
you will found the smart part in the below link.
http://www.codeplex.com/smartpart/Release/ProjectReleases.aspx?ReleaseId=10697

The latest release for smart part is v1.3. it is a good webpart developed by inheriting sharepoint webpart.This supports ajax also.

Now the Question is can we integrate our smartpart with silverlight.

I tried in multiple ways but i got succeded in Following way. (as usercontrol is .net controls we have to render our controls on top of the silverlight content)

To integrate Smart part and silverlight the procedure we have to follow is:
1) Create a web part with silverlight rendering.(silverlight web part)
2) Overlap Smart part on the silverlight web part.


Open the User Control and place your code in the div tag.

<-div style="position:absolute; width: 600px; height: 100px; z-index: 1; left: 24px; top: 95px" id="layer1">
This makes the control to Render at our required position. We can adjust the properties as per our requirement.

My user control looks like below in design mode.(Just adding two numbers)



Output of the user control after rendering on silverlight web part in my SharePoint site.
Output in the IE Browser.(As this differs very little in mozilla).



Cheers it worked for me i have some more options
1)rendering directly silverlight content in usercontrol it worked for me if it is .net application but it is not working for sharepoint i may miss some thing ill try soon and update.
2)inheriting the smartpart webpart and adding our code in Onprerendermethod and override rendermethod.(didnt gave a try.)

now you can give a try with this. :)

1 comment:

rockyrf said...

I have a user control containing a silverlight control.
But I am not able to add this user control in Smartpart(Ajax). Can you please provide more information on how you embeded the silverlight control in UserControl