free visual basic qr code generator Part VII: Developing Web Parts in Visual Studio .NET in .NET

Creator Code 128B in .NET Part VII: Developing Web Parts in Visual Studio .NET

Part VII: Developing Web Parts in Visual Studio .NET
USS Code 128 Printer In .NET
Using Barcode drawer for .NET Control to generate, create Code 128C image in Visual Studio .NET applications.
www.OnBarcode.com
Code 128B Recognizer In .NET Framework
Using Barcode decoder for VS .NET Control to read, scan read, scan image in VS .NET applications.
www.OnBarcode.com
Creating Custom Administration Tools
Create Barcode In .NET
Using Barcode generation for VS .NET Control to generate, create bar code image in Visual Studio .NET applications.
www.OnBarcode.com
Bar Code Recognizer In .NET Framework
Using Barcode decoder for VS .NET Control to read, scan read, scan image in .NET applications.
www.OnBarcode.com
Writing the ListSites Method
Code 128 Code Set B Drawer In C#
Using Barcode drawer for .NET Control to generate, create Code 128B image in .NET applications.
www.OnBarcode.com
Draw Code 128 Code Set C In .NET
Using Barcode creator for ASP.NET Control to generate, create ANSI/AIM Code 128 image in ASP.NET applications.
www.OnBarcode.com
Both the RepostLoaded event handler and the BtnAddClick event handler call this method to display a current listing of top-level sites. To code the method, proceed as follows:
Paint Code 128 Code Set C In VB.NET
Using Barcode maker for VS .NET Control to generate, create Code-128 image in VS .NET applications.
www.OnBarcode.com
EAN / UCC - 13 Maker In Visual Studio .NET
Using Barcode generation for .NET framework Control to generate, create EAN / UCC - 14 image in VS .NET applications.
www.OnBarcode.com
1 Declare a method named ListSites. As usual, locate this anywhere within the TopSite class, but not within any other method or structure. Here s the code:
UCC - 12 Generation In .NET
Using Barcode generation for VS .NET Control to generate, create GTIN - 12 image in VS .NET applications.
www.OnBarcode.com
Encode Data Matrix In VS .NET
Using Barcode creation for .NET Control to generate, create DataMatrix image in Visual Studio .NET applications.
www.OnBarcode.com
void ListSites () { }
Printing Bar Code In Visual Studio .NET
Using Barcode generation for Visual Studio .NET Control to generate, create barcode image in .NET framework applications.
www.OnBarcode.com
Leitcode Generator In .NET
Using Barcode drawer for .NET framework Control to generate, create Leitcode image in .NET framework applications.
www.OnBarcode.com
2 Within the curly braces from step 1, declare an HtmlTable variable named tblSites and an HtmlTableRow named rowSites.
Creating Code128 In None
Using Barcode drawer for Online Control to generate, create Code 128C image in Online applications.
www.OnBarcode.com
Generate Bar Code In None
Using Barcode creator for Font Control to generate, create bar code image in Font applications.
www.OnBarcode.com
void ListSites () { HtmlTable tblSites; HtmlTableRow rowSites; }
Denso QR Bar Code Creation In VB.NET
Using Barcode generator for .NET Control to generate, create QR Code image in Visual Studio .NET applications.
www.OnBarcode.com
PDF 417 Maker In Visual C#.NET
Using Barcode printer for .NET Control to generate, create PDF-417 2d barcode image in .NET framework applications.
www.OnBarcode.com
3 Instantiate the HtmlTable object. Then, to avoid sending large amounts of ViewState data to the browser (and receiving it back), set its EnableViewState property to false. This requires the code shown below in bold.
PDF 417 Decoder In Java
Using Barcode decoder for Java Control to read, scan read, scan image in Java applications.
www.OnBarcode.com
Print UPC-A Supplement 5 In None
Using Barcode generation for Font Control to generate, create UPC-A image in Font applications.
www.OnBarcode.com
HtmlTable tblSites; HtmlTableRow rowSites; tblSites = new HtmlTable(); tblSites.EnableViewState = false;
Code 128A Generator In None
Using Barcode creation for Office Excel Control to generate, create Code 128 Code Set C image in Microsoft Excel applications.
www.OnBarcode.com
Generating QR Code 2d Barcode In VS .NET
Using Barcode maker for Reporting Service Control to generate, create QR image in Reporting Service applications.
www.OnBarcode.com
4 Add a table row to the tblSites table, set a variable that points to it, and set its class attribute to ms-vh. This is the usual CSS class for SharePoint table headings.
tblSites.Rows.Add(new HtmlTableRow()); rowSites = tblSites.Rows[tblSites.Rows.Count - 1]; rowSites.Attributes["class"] = "ms-vh";
5 Add six cells to the row, then store the six column headings in them.
rowSites.Cells.Add(new HtmlTableCell()); rowSites.Cells.Add(new HtmlTableCell()); rowSites.Cells.Add(new HtmlTableCell()); rowSites.Cells.Add(new HtmlTableCell()); rowSites.Cells.Add(new HtmlTableCell()); rowSites.Cells.Add(new HtmlTableCell()); rowSites.Cells[0].InnerText = "Top Site"; rowSites.Cells[1].InnerText = "Title"; rowSites.Cells[2].InnerText = "Owner Name"; rowSites.Cells[3].InnerText = "Owner Login"; rowSites.Cells[4].InnerText = "Owner E-Mail"; rowSites.Cells[5].InnerText = "Last Modified";
21
21
21
21
21
Part VII: Developing Web Parts in Visual Studio .NET
Microsoft Windows SharePoint Services Inside Out
6 Set up a loop that iterates through each member of the Names collection in the current virtual server s SPSiteCollection object. The sscTopLvs variable points to this object. Here s the code:
foreach (string strTopUrl in sscTopLvs.Names) { }
Each item in the Names collection contains the relative URL of one top-level site. 7 VirtualServer objects have a MakeFullUrl method that converts a relative URL such as sites/buyensj to a fully qualified URL such as http://wish.interlacken/com/sites/buyensj. Using this method, get the fully qualified URL of the current top-level site, and then use the result to create an SPSite object named spsSiteColl. This requires the code shown below in bold.
foreach (string strTopUrl in sscTopLvs.Names) { SPSite spsSiteColl = new SPSite(sscTopLvs.VirtualServer.MakeFullUrl(strTopUrl)); }
21 21 21 21 21
8 Add a new row to the table you created in step 3, and then add six cells to that row. Here s the required code in bold:
foreach (string strTopUrl in sscTopLvs.Names) { SPSite spsSiteColl = new SPSite(sscTopLvs.VirtualServer.MakeFullUrl(strTopUrl)); tblSites.Rows.Add(new HtmlTableRow()); rowSites = tblSites.Rows[tblSites.Rows.Count - 1]; rowSites.Cells.Add(new HtmlTableCell()); rowSites.Cells.Add(new HtmlTableCell()); rowSites.Cells.Add(new HtmlTableCell()); rowSites.Cells.Add(new HtmlTableCell()); rowSites.Cells.Add(new HtmlTableCell()); rowSites.Cells.Add(new HtmlTableCell()); }
9 For each of the six table cells you created in step 8, set the valign= attribute to top. This requires the following code, next in sequence.
foreach (HtmlTableCell celSites in rowSites.Cells) { celSites.VAlign = "top"; }
Part VII: Developing Web Parts in Visual Studio .NET
Creating Custom Administration Tools
10 Create an HtmlAnchor object (that is, a hyperlink). If the current top-level site s URL is empty, make the HtmlAnchor object display (root); otherwise, make it display the site s relative URL. Set the hyperlink s Href property to the fully qualified version of the toplevel site s URL, and then add the HtmlAnchor object to the first table cell s Controls collection. Append this code to that from the previous step.
HtmlAnchor ancTopUrl = new HtmlAnchor(); if (strTopUrl == "") { ancTopUrl.InnerText = "(root)"; } else { ancTopUrl.InnerText = strTopUrl; } ancTopUrl.HRef = spvServer.MakeFullUrl(strTopUrl); rowSites.Cells[0].Controls.Add(ancTopUrl);
11 Load table cells 2 through 6 with their respective property values. Here s the code:
rowSites.Cells[1].InnerText = spsSiteColl.RootWeb.Title; rowSites.Cells[0].Controls.Add(ancTopUrl); rowSites.Cells[2].InnerText = spsSiteColl.Owner.Name; rowSites.Cells[3].InnerText = spsSiteColl.Owner.LoginName; rowSites.Cells[4].InnerText = spsSiteColl.Owner.Email; rowSites.Cells[5].InnerText = spsSiteColl.LastContentModifiedDate.ToLocalTime().ToString();
12 Add the tblSites table to the Web Part s Controls collection. Make sure this statement is within the ListSites method, but not within the loop that iterates through the sscTopLvs.Names collection.
Controls.Add(tblSites);
This completes the code for the ListSites method. A complete listing appears below.
21
void ListSites () { HtmlTable tblSites; HtmlTableRow rowSites; tblSites = new HtmlTable(); tblSites.EnableViewState = false; tblSites.Rows.Add(new HtmlTableRow()); rowSites = tblSites.Rows[tblSites.Rows.Count - 1]; rowSites.Attributes["class"] = "ms-vh"; rowSites.Cells.Add(new HtmlTableCell()); rowSites.Cells.Add(new HtmlTableCell()); rowSites.Cells.Add(new HtmlTableCell()); rowSites.Cells.Add(new HtmlTableCell());
Copyright © OnBarcode.com . All rights reserved.