In Sharepoint development, what should I do when the Silverlight APPLICATION IN THE WebPart wants to operate the list, such as adding data to a list in Sharepoint? We know that Silverlight is a browser-side application and cannot directly operate on the list in Sharepoint. It can only interact with Sharepoint through its carrier-WebPart, then, you will naturally think of using Silverlight to call the script on the page and pass parameters. The script then uses Ajax to send the data passed by Silverlight back-end code to the Webpart, this article will explore this.
First, create a Silverlight project and change its Build directory to ClientBin under the layouts directory in Sharepoint.
C: \ Program Files \ Common Files \ Microsoft Shared \ Web Server Extensions \ 14 \ TEMPLATE \ LAYOUTS \ ClientBin \
Create a WebPart project. Note that the Sharepoint site is selected when Debug and Deploy are selected.
After completing the above two steps, you can open the website and edit the page to verify that the website can be correctly deployed.
After the project is created, we try to call the Ajax operation list through Silverlight.
We need to preset a piece of code in the WebPart for Silverlight to call. Here we use the background Render to go to the foreground
Processing Ajax requests in the background Page_Load event
Then, call Silverlight in Rend.
At this point, the Silverlight program can be displayed in Sharepoint. We need to call the page script through the API in Silverlight.
Try it!