1. How to Use the SharePoint control in webpart?
To use the SharePoint control in a webpart, you must first reference Microsoft. sharepoint. the webcontrols name is blank. If quickpart is created, you need to add the SharePoint control to the ascx file. How can this problem be solved?
A. Add the following reference to the asxc file:
% @ Register tagprefix = "SharePoint" namespace = "Microsoft. sharepoint. webcontrols "assembly =" Microsoft. sharepoint, version = 12.0.0.0, culture = neutral, publickeytoken = 71e9bce111e9429c "%> <% @ register tagprefix =" utilities "namespace =" Microsoft. sharepoint. utilities "assembly =" Microsoft. sharepoint, version = 12.0.0.0, culture = neutral, publickeytoken = 71e9bce111e9429c "%>
B. Add an employee selection box control to the asxc file.
<SharePoint: peopleeditor id = "upuid" runat = "server" selectionset = "user" validatorenabled = "true" allowempty = "true" multiselect = "false" width = "150"/>
The method by which the back-end token gets the selected token is:
Upuid. commaseparatedaccounts;
C. Add a date Selection control to the asxc file.
<SharePoint: datetimecontrol id = "update1" runat = "server" dateonly = "true" cssclasstextbox = "fr_date"/>
The method for obtaining the date of the selected token on the back end is as follows:
String tmp_udpate1 = update1.selecteddate. tostring ("yyyy-mm-dd 00:00:00 ");
If (update1.isdateempty) tmp_udpate1 = "";
D. Other controls can be described in the SDK ......
2. How can we control the style when developing a webpart so that it will change with the change of the scenery subject of the SharePoint website?
A. Let's take a look at the same-style control on the table list interface.
<Table class = "MS-formtable" style = "margin-top: 5px;" border = "0" cellpadding = "0" cellspacing = "0" width = "100%">
<Tr>
<TD class = "fr_td1 MS-formlabel"> uploaded by: </TD>
<TD class = "fr_td2 MS-formbody">
<SharePoint: peopleeditor id = "upuid" runat = "server"
Selectionset = "user"
Validatorenabled = "true"
Allowempty = "true"
Multiselect = "false"
Width = "150"
/>
</TD>
<TD class = "fr_td1 MS-formlabel"> upload Date: </TD>
<TD class = "fr_td2 MS-formbody">
<Table border = "0" cellpadding = "0" cellspacing = "0" width = "100%">
<Tr>
<TD>
<SharePoint: datetimecontrol id = "update1" runat = "server" dateonly = "true" cssclasstextbox = "fr_date"/>
</TD>
<TD>
~
</TD>
<TD>
<SharePoint: datetimecontrol id = "update2" runat = "server" dateonly = "true" cssclasstextbox = "fr_date"/>
</TD>
</Tr>
</Table>
</TD>
</Tr>
<Tr>
<TD class = "fr_td1 MS-formlabel"> bit: </TD>
<TD class = "fr_td2 MS-formbody">
<Asp: dropdownlist id = "webtitle" runat = "server"> </ASP: dropdownlist>
</TD>
<TD class = "fr_td1 MS-formlabel"> Format: </TD>
<TD class = "fr_td2 MS-formbody">
<Asp: checkboxlist runat = "server" id = "Ext" repeatdirection = "horizontal" repeatcolumns = "5"> </ASP: checkboxlist>
</TD>
</Tr>
<Tr>
<TD class = "MS-formlabel"> <Table> </table> </TD>
<TD class = "MS-formlabel" colspan = "3">
<Table> </table>
</TD>
</Tr>
</Table>
The table in the table form uses the MS-formtable format.
The TD where the plain text in the table is located uses the format MS-formlabel
The TD where the control of a table is located uses the MS-formbody format.
Use the following formula as per dimensions: MS-buttonheightwidth
B. Let's take a look at the format used in the list.
<Asp: gridview id = "filelist" runat = "server" autogeneratecolumns = "false" width = "100%" cssclass = "MS-listviewtable">
<Headerstyle cssclass = "MS-viewheadertr" Height = "25"/>
<Alternatingrowstyle cssclass = "MS-alternating" Height = "23"/>
<Rowstyle cssclass = "" Height = "23"/>
<Columns>
<Asp: templatefield headertext = "no" headerstyle-cssclass = "ms-vh2 fr_header" itemstyle-cssclass = "ms-vb2 fr_item1">
<Itemtemplate>
<% # Container. dataitemindex + 1%>
</Itemtemplate>
</ASP: templatefield>
<Asp: boundfield datafield = "upuid" headertext = "upper publisher" headerstyle-cssclass = "ms-vh2 fr_header" itemstyle-cssclass = "ms-vb2 fr_item3"/>
<Asp: boundfield datafield = "Update" headertext = "Expiration" htmlencode = "false" dataformatstring = "{0: yyyy-mm-dd} "headerstyle-cssclass =" ms-vh2 fr_header "itemstyle-cssclass =" ms-vb2 fr_item2 "/>
<Asp: boundfield datafield = "upcount" headertext = "upper case (upper case)" headerstyle-cssclass = "ms-vh2 fr_header" itemstyle-cssclass = "ms-vb2 fr_item3"/>
<Asp: templatefield headertext = "case name example" headerstyle-cssclass = "ms-vh2 fr_header" itemstyle-cssclass = "ms-vb2 fr_item4">
<Itemtemplate>
<% # Getfiles (eval ("Update") %>
</Itemtemplate>
</ASP: templatefield>
</Columns>
</ASP: gridview>
The List table uses the MS-listviewtable format.
Table topic tr uses the format MS-viewheadertr
Table topic TD uses a similar ms-vh2
Single Data row tr uses the same MS-alternating
The TD of the Main part uses a similar ms-vb2
In this way, the developed webpart changes with the changes of the website subject, as shown in the following figure:
Title"Set the subject"Representation:
Title"Citrus"Representation:
3. spquery metric data description:
- Viewattributes
A. Scope = 'default': only lists the contents and subfiles under the specified file category.
B. Scope = 'filesonly ': Only displays the objects under the specified file quota.
C. Scope = 'authorization': displays all objects, not the objects
D. Scope = 'recursiveall': displays all contents and all subfiles
- Rowlimit
How many records are returned?
- Listitemcollectionposition