« Home « Chủ đề ASP.NET Configuration

Chủ đề : ASP.NET Configuration


Có 40+ tài liệu thuộc chủ đề "ASP.NET Configuration"

ASP.NET 4 Unleased - p 20

tailieu.vn

ptg 164 CHAPTER 3 Using the Validation Controls. id=”txtLastName”. Runat=”server” />. <asp:RequiredFieldValidator id=”reqLastName”. ControlToValidate=”txtLastName”. <asp:Button id=”btnSubmit”. If you submit the form in Listing 3.18 without entering a value for the first and last name, validation error messages appear in both the body of the page and in the. DisplayMode —Enables you to specify how the error messages are formatted. HeaderText...

ASP.NET 4 Unleased - p 21

tailieu.vn

ptg 174 CHAPTER 3 Using the Validation Controls. The page in Listing 3.24 illustrates how you can use the AjaxValidator control. This page handles the AjaxValidator control’s ServerValidate event to associate a custom validation function with the control.. It is important to realize that you can associate any server-side validation function with the AjaxValidator . Page Language=”C#” %>. Register TagPrefix=”custom”...

ASP.NET 4 Unleased - p 22

tailieu.vn

The method restricts the type of file that can be uploaded based on the file extension.. To save a file to the file system, the Windows account associated with the ASP.NET page must have sufficient permissions to save the file. For Windows 2003 and Windows 2008 servers, an ASP.NET page executes in the security context of the NETWORK SERVICE account....

ASP.NET 4 Unleased - p 23

tailieu.vn

ptg LISTING 4.6 FileHandlerLarge.ashx. WebHandler Language=”C#” Class=”FileHandlerLarge” %>. const string conString = @”Server=.\SQLExpress;Integrated Security=True;. context.Response.Buffer = false;. Id=@Id”, con);. cmd.Parameters.AddWithValue(“@Id”, context.Request[“Id”]);. context.Response.BinaryWrite(chunk);. context.Response.BinaryWrite(actualChunk);. The HTTP Handler in Listing 4.6 uses a SqlDataReader to retrieve a file from the database.. The contents of the database column are pulled into memory in 8,040-byte chunks. Because buffering is disabled, the output of the...

ASP.NET 4 Unleased - p 24

tailieu.vn

<head id=”Head1” runat=”server”>. <form id=”form1” runat=”server”>. <asp:Calendar id=”calSchedule”. Runat=”server” />. <asp:FormView id=”frmSchedule”. Runat=”server”>. <asp:LinkButton id=”btnNew”. Eval(“Entry”) %>. <asp:LinkButton Id=”btnEdit”. <asp:LinkButton Id=”lnkDelete”. <asp:Label id=”lblEntry”. <asp:TextBox id=”txtEntry”. Text=’<%#Bind(“Entry”) %>’. <asp:LinkButton id=”btnUpdate”. <asp:Button id=”btnInsert”. </asp:FormView>. <asp:SqlDataSource id=”srcSchedule”. <asp:ControlParameter Name=”EntryDate”. PropertyName=”SelectedDate” />. </asp:SqlDataSource>. <asp:SqlDataSource id=”srcCalendar”. The AdRotator control includes a KeywordFilter property. Page Language=”C#” %>. <style type=”text/css”>. <div class=”content”>. <asp:AdRotator id=”AdRotator1”. <div class=”box”>. <asp:AdRotator...

ASP.NET 4 Unleased - p 25

tailieu.vn

The page in Listing 4.14 displays a banner advertisement with the AdRotator control. The page includes an event handler for the AdRotator control’s AdCreated event.. LISTING 4.14 AdRotatorTrack.aspx. Page Language=”C#” %>. “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>. <script runat=”server”>. e.AdProperties[“Id”].ToString();. <html xmlns=”http://www.w3.org/1999/xhtml” >. <head id=”Head1” runat=”server”>. <form id=”form1” runat=”server”>. <asp:AdRotator id=”AdRotator1”. Runat=”server” />. <asp:SqlDataSource. Runat=”server”>. <asp:Parameter Name=”AdId” Type=”int32” />. </asp:SqlDataSource>. This file is contained in...

ASP.NET 4 Unleased - p 26

tailieu.vn

You can use these commands with any of the button controls— Button , LinkButton , and ImageButton —by setting the button control’s CommandName property and, in the case of the SwitchViewByID and SwitchViewByIndex , by setting the CommandArgument property.. Page Language=”C#” %>. “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>. <script runat=”server”>. lblFirstNameResult.Text = txtFirstName.Text;. lblColorResult.Text = txtColor.Text;. <html xmlns=”http://www.w3.org/1999/xhtml” >. <head id=”Head1” runat=”server”>. <form id=”form1” runat=”server”>....

ASP.NET 4 Unleased - p 27

tailieu.vn

type=”application/x-silverlight-2”>. <param name=”source” value=”SilverlightApplication1.xap” />. <param name=”onerror” value=”onSilverlightError” />. <param name=”background” value=”black” />. <param name=”autoUpgrade” value=”true” />. style=”text-decoration: none;”>. style=”border-style: none” />. Listing 4.20 displays a simple web page with a Silverlight control. You learned how to perform file uploads with the FileUpload control. You also saw how to accept and display large file uploads by dividing the file into...

asp.net 4 unleased - p 28

tailieu.vn

<form id=”form1” runat=”server”>. <div class=”content”>. <div class=”leftColumn”>. <asp:contentplaceholder id=”ContentPlaceHolder1”. runat=”server”/>. </div>. <div class=”middleColumn”>. <asp:ContentPlaceholder id=”ContentPlaceHolder2”. runat=”server” />. <div class=”rightColumn”>. <asp:ContentPlaceHolder id=”contentAd”. Runat=”server”>. <asp:Image id=”imgAd”. Runat=”server” />. </asp:ContentPlaceHolder>. <br class=”clear” />. The content page in Listing 5.4 uses the Master Page in Listing 5.3. It does not include a Content control that corresponds to the contentAd control in the Master Page....

ASP.NET 4 Unleased - p 29

tailieu.vn

You can apply a Master Page to every content page in a particular folder or every content page in an entire application. Rather than add a MasterPageFile attribute to individual content pages, you can add a configuration option to the web configuration file.. For example, the web configuration file in Listing 5.12 applies the SimpleMaster.master Master Page to every page...

ASP.NET 4 Unleased - p 30

tailieu.vn

Profile.MasterPageFile = “Dynamic2.master”;. Runat=”Server”>. Select a Master Page:. <ul class=”selectMaster”>. <a href=”DynamicContent.aspx?master=Dynamic1”>Dynamic Master 1</a>. <a href=”DynamicContent.aspx?master=Dynamic2”>Dynamic Master 2</a>. The page in Listing 5.20 contains two links. Both links include a query string parameter named master , which represents the name of a Master Page. When you click the first link, the Dynamic1.master Master Page loads (see Figure 5.7) and when...

asp.net 4 unleased - p 31

tailieu.vn

ptg LISTING 6.4 ShowNamedSkin.aspx. Page Language=”C#” Theme=”Simple2” %>. “http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”>. <html xmlns=”http://www.w3.org/1999/xhtml” >. <head runat=”server”>. <title>Show Named Skin</title>. <form id=”form1” runat=”server”>. <asp:TextBox. id=”txtFirstName”. Runat=”server” />. id=”txtLastName”. When you open the page in Listing 6.4, the first TextBox appears with a dashed border, and the second TextBox appears with a double border (see Figure 6.2).. When you apply a Theme to a...

ASP.NET 4 Unleased - p 32

tailieu.vn

The advantage of using Cascading Style Sheets is that they result in leaner and faster loading pages. The more content that you can place in an external Style Sheet, the less content must be loaded each time you make a page request. The contents of an external Style Sheet can be loaded and cached by a browser and applied to...

ASP.NET 4 Unleased - p 33

tailieu.vn

ptg For example, the page in Listing 6.20 enables a user to select a favorite skin for a GridView. LISTING 6.20 ShowDynamicSkin.aspx. Page Language=”C#” Theme=”DynamicSkin” %>. “http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”>. <script runat=”server”>. <html xmlns=”http://www.w3.org/1999/xhtml” >. <head runat=”server”>. <form id=”form1” runat=”server”>. <asp:GridView id=”grdMovies”. Runat=”server” />. <asp:SqlDataSource id=”srcMovies”. ConnectionString=”<. <a href=”showdynamicskin.aspx?skin=professional”>Professional</a>. <a href=”showdynamicskin.aspx?skin=colorful”>Colorful</a>. It makes more sense to use a CSS and modify a control’s...

ASP.NET 4 Unleased - p 34

tailieu.vn

You need to be aware of one important limitation when registering a User control in the web configuration file. A User control cannot be located in the same folder as a page that uses it. Exposing Properties from a User Control. The RandomImage User control always displays an image from the Images folder. You can do this by exposing a...

ASP.NET 4 Unleased - p 35

tailieu.vn

Runat=”server” />. <div class=”addressField”>. <asp:TextBox ID=”txtCity”. <asp:RequiredFieldValidator ID=”reqCity”. <br class=”clear” />. <div class=”addressLabel”>. <asp:Label ID=”lblState”. <asp:TextBox ID=”txtState”. <asp:RequiredFieldValidator ID=”reqState”. <asp:Label. ID=”lblPostalCode”. <asp:TextBox. ID=”txtPostalCode”. <asp:RequiredFieldValidator ID=”RequiredFieldValidator1”. The page in Listing 7.11 illustrates how you can use the AddressForm control in a page.. LISTING 7.11 Checkout.aspx. Page Language=”C#” %>. Register TagPrefix=”user” TagName=”AddressForm” Src=”~/AddressForm.ascx” %>. “http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”>. <script runat=”server”>. ltlResults.Text = “<br />Billing Street....

asp.net 4 unleased - p 36

tailieu.vn

<html xmlns=”http://www.w3.org/1999/xhtml” >. <head id=”Head1” runat=”server”>. <style type=”text/css”>. <form id=”form1” runat=”server”>. <asp:Label. id=”lblLanguage”. Text=”What language do you use to develop Web applications?”. Runat=”server” />. <asp:DropDownList id=”ddlLanguage”. Runat=”server”>. <asp:ListItem Text=”Select Language” />. <asp:ListItem Text=”ASP Classic” />. <asp:ListItem Text=”ASP.NET” />. </asp:DropDownList>. <asp:PlaceHolder id=”PlaceHolder1”. <asp:Button id=”btnSubmit”. Text=”Submit”. <asp:Literal id=”ltlResults”. The DropDownList control in Listing 7.15 reloads the page automatically when you select a...

asp.net 4 unleased - p 37

tailieu.vn

ptg 334 CHAPTER 7 Creating Custom Controls with User Controls. and move to the next step. Move to the previous step. <html xmlns=”http://www.w3.org/1999/xhtml” >. <head id=”Head1” runat=”server”>. <style type=”text/css”>. <form id=”form1” runat=”server”>. <asp:Label. id=”lblStepNumber”. Runat=”server” />. <legend><asp:Literal ID=”ltlStep” runat=”server” /></legend>. <asp:PlaceHolder id=”plhWizardStep”. <asp:Button. id=”btnPrevious”. <asp:Button id=”btnNext”. The path to each wizard step User control is added to a collection of...

asp.net 4 unleased - p 38

tailieu.vn

<div class=”floater”>. Runat=”server” />. Runat=”server”>. <%#Eval(“Title”)%>. <%#Eval(“Director”)%>. <asp:Repeater id=”Repeater1”. <div id=”itemContainer” runat=”server”>. <asp:DataPager ID=”pager1” PageSize=”3” runat=”server”>. <asp:SqlDataSource id=”srcMovies”. Page Language=”C#” %>. <head id=”Head1” runat=”server”>. <form id=”form1” runat=”server”>. <asp:TreeView. <asp:Menu. <asp:XmlDataSource id=”srcMovies”. Import Namespace=”System.IO” %>. <script runat=”server”>. runat=”server”>. ImageUrl=’<

ASP.NET 4 Unleased - p 39

tailieu.vn

LISTING 8.7 ShowControlParameter.aspx. Page Language=”C#” %>. “http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”>. <html xmlns=”http://www.w3.org/1999/xhtml” >. <head id=”Head1” runat=”server”>. <form id=”form1” runat=”server”>. <asp:DropDownList. id=”ddlMovieCategory”. Runat=”server” />. <asp:Button id=”btnSelect”. <asp:GridView id=”grdMovies”. <asp:SqlDataSource. id=”srcMovieCategories”. <asp:SqlDataSource id=”srcMovies”. Runat=”server”>. <asp:ControlParameter Name=”Id”. ControlID=”ddlMovieCategory” />. </asp:SqlDataSource>. The value of the. ControlParameter is used in the SqlDataSource control’s SelectCommand to select movies that match the category selected in the DropDownList control.. Or you...