Some people often ask how to use Custom User Controls on moss pages? We usually use webpart, which is also a recommended method for Sharepoint development, but sometimes we also need to use some custom controls, in this article, I made the moss home page rotation display image library picture of the custom controls for example (see http://bbs.winos.cn/viewthread.php? Tid = 33985 & Highlight =.
The development of SharePoint Server controls is no different from that of common Asp.net server controls, except that some special configurations are required during deployment.
1. download the sample custom control in the attachment, decompress it, and open the testwebcontrollibrary project .. the generated control DLL testwebcontrollibrary is displayed in the \ testwebcontrollibrary \ bin \ debug path. DLL and the script file jscript1.js, add the DLL to GAC (c: \ windows \ assembly), copy the script file jscript1.js to C: \ Inetpub \ wwwroot \ WSS \ virtualdirectories \ 80 \ bin ).
2. Use reflector to obtain control information. If the generated DLL is used directly, it is "testwebcontrollibrary, version = 1.0.3212.28585, culture = neutral, publickeytoken = f030a43b092aca78" and the namespace is testwebcontrollibrary.
3. open the web under c: \ Inetpub \ wwwroot \ WSS \ virtualdirectories \ 80. config (select the corresponding path based on the actual situation), and add a line in <safecontrols> </safecontrols>:
<Safecontrol Assembly = "testwebcontrollibrary, version = 1.0.3212.28585, culture = neutral, publickeytoken = f030a43b092aca78" namespace = "testwebcontrollibrary" typename = "*" Safe = "true"/>
4. Create a test page. Website operation ---- create ------ blank page, the RTF editor will pop up, we cannot use, click Cancel, on this page, we use the content placeholder control is placeholdermain, delete the webpartzone, delete content between <TD> </TD>. After deletion, the placeholder control content should be as follows:
<Asp: Content contentplaceholderid = "placeholdermain" runat = "server">
<Table cellpadding = "4" cellspacing = "0" border = "0" width = "100%">
<Tr valign = "TOP">
& Lt; TD width = "100%" & gt;
</TD>
</Tr>
</Table>
</ASP: content>
5. register the user control on the test page. If you directly use the generated DLL, add the following at the top of the page:
<% @ Register Assembly = "testwebcontrollibrary, version = 1.0.3212.28585, culture = neutral, publickeytoken = f030a43b092aca78" namespace = "testwebcontrollibrary" tagprefix = "ccimage" %>
6. Create a picture library for test on the top-level website. The attachment image is the image I used for testing. Remember, if you use the built-in DLL, you must create a picture library in the top-level website, because the path is dead in my code, and you can modify it at will.
7. Use custom controls on the test page. Add the following between the placeholder control placeholdermain <TD> </TD>:
<Ccimage: webcustomcontrol1 id = "myimage" runat = "server" imagesurl = "ccimage"> </ccimage: webcustomcontrol1>
Here, the imageurl points to the name of the image library you created, and my name is ccimage.
8. view the test page to see the results. Controls rotate all images in the Image Library. For more information about controls, see rotate images in the image library on the moss homepage.
Testwebcontrollibrary.rar images.rar
This article reposted from: "href =" http://bbs.winos.cn/thread-46645-1-1.html "target =" _ blank "> use custom controls in the moss page --- take rotation display image as an Example