Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Professional ASP.NET 3.5 in C# and Visual Basic Part 23. Building on the revolutionary ASP.NET 2.0 release, ASP.NET 3.5 adds several key new developer features including AJAX, LINQ, and a new CSS designer in Visual Web Developer 2008. The dramatic reduction in code that developers realized from the more than 50 new server controls in ASP.NET 2.0 now allows developers the time to make their applications more interactive with AJAX, to work with data in their preferred language with LINQ, and to build visually attractive and consistent standards-based sites with CSS. . | Chapter 3 ASP.NET Web Server Controls Listing 3-39 Uploading the file contents into a Byte array VB Dim myByteArray As Byte Dim myStream As System.IO.MemoryStream myStream FileUploadl.FileContent myByteArray myStream.ToArray C Byte myByteArray System.IO.Stream myStream myStream FileUploadl.FileContent myByteArray myStream.ToArray In this example instances of a Byte array and a MemoryStream object are created. First the MemoryStream object is created using the FileUpload control s Filecontent property as you did previously. Then it s fairly simple to use the MemoryStream object s ToArray method to populate the myByteArray instance. After the file is placed into a Byte array you can work with the file contents as necessary. MultiView and View Server Controls The MultiView and View server controls work together to give you the capability to turn on off sections of an ASP.NET page. Turning sections on and off which means activating or deactivating a series of View controls within a MultiView control is similar to changing the visibility of Panel controls. For certain operations however you may find that the MultiView control is easier to manage and work with. The sections or views do not change on the client-side rather they change with a postback to the server. You can put any number of elements and controls in each view and the end user can work through the views based upon the sequence numbers that you assign to the views. You can build these controls like all server controls from the source view or design view. If working with Visual Studio 2008 you can drag and drop a MultiView control onto the design surface and then drag and drop any number of View controls inside the MultiView control. Place the elements you want within the View controls. When you are finished you have something like the view shown in Figure 3-41. You also can create your controls directly in the code as shown in Listing 3-40. Listing 3-40 Using the MultiView and View server controls VB @ Page