Haven't posted in a week or so. So decided it was time to add something. Lots of idea bouncing while I have been attending a training course on SharePoint Designer.
A question came up during class which was, "How do I add custom controls into SharePoint Designer that I can drag-and-drop like the controls already there? For example, the ASP.NET controls.".
Here is the answer...
You will need to first copy your DLL and namespace to the SafeControls section of the 'web.config' file. This will make your control available to SharePoint Designer. However, an extra step is needed to make the control visible inside the GUI.
You will need to add an attribute to your class file. Just above your class definition. The attribute is:
[ToolboxData("<{0}:SomeNewControl runat=\"server\" />"), ToolboxItemFilter("Foo")]
Again, this goes above your class definition. That is it. You should now see your custom control inside SharePoint Designer under 'Server Controls'. And it should work just like the others (drag-and-drop).
Blogging about software programming, SharePoint, hunting, video games, system administration, customer service, brewing, project management and other flavored topics.
Wednesday, October 26, 2011
Tuesday, October 4, 2011
Migration to SharePoint 2010: Part 3 - Integrating the ASP.NET Web Service into a SharePoint page
In my final posting for this 3-part blog, I will detail the simple steps needed to integrate the ASP.NET Web Service we have worked on into your SharePoint site.
To add this Web Service directly to a page in SharePoint do the following:
- Open Microsoft SharePoint Designer 2010.
- Click on Open Site.
- Under Site name enter the location to the SharePoint site you wish to connect too. Click Open.
- Under the quick launch area (located to the left of the screen) expand the Site Objects tab.
- Click on Data Sources. The summary area should now show you a list of data sources that are inside SharePoint. Such as lists, document libraries, etc.
- Click on SOAP Service Connection in the ribbon, located at the top of the screen. You will see the following:
- The Service description location is where you will want to put the path to your ASP.NET WSDL. Should be something like https://localhost/ws-server/MyWebService.asmx?WSDL or whatever you setup.
- Click on Connect Now or Reconnect. You should see your other fields light up.
To add this Web Service directly to a page in SharePoint do the following:
- Still remaining in SharePoint Designer, click on the Site Pages option under Site Objects.
- Add a new ASPX page. You can add this page by:
- Click on the drop-down menu for Page from your ribbon at the top of the screen.
- Select ASPX and rename the file.
- Right-click on the newly created file from your summary screen.
- Select Edit File in Advanced Mode from the context menu.
- You will see some code but, what you are interested in is the code between the <form> tags. Click and place your cursor between those tags. Or whatever you have setup on the page to meet your needs.
- From your ribbon you will want to select the Insert tab.
- Under the Data Views & Forms category you will want to select Data View. This will present you with a list of options.
- Scroll down until you find the SOAP service you created under Data Sources earlier. If everything is successful, you should see a new DataFormWebPart that contains data fed back from the Web Service you just called. If you get an error you may need to check your logs to determine why.
Subscribe to:
Posts (Atom)