亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

ディレクトリ 検索
ASP.NET 基礎(chǔ)教程 ASP.NET 教程 Web Pages - 教程 Web Pages - 添加 Razor 代碼 Web Pages - 頁(yè)面布局 Web Pages - 文件夾 Web Pages - 全局頁(yè)面 Web Pages - HTML 表單 Web Pages - 對(duì)象 Web Pages - 文件 Web Pages - 幫助器 Web Pages - WebGrid 幫助器 Web Pages - Chart 幫助器 Web Pages - WebMail 幫助器 Web Pages - PHP Web Pages - 發(fā)布網(wǎng)站 Razor - 標(biāo)記 Web Pages - Database 對(duì)象 ASP.NET MVC Web Forms - 教程 Web Forms - HTML 頁(yè)面 Web Forms - 服務(wù)器控件 Web Forms - 事件 Web Forms - HTML 表單 Web Forms - 維持 ViewState Web Forms - TextBox 控件 Web Forms - Button 控件 Web Forms - 數(shù)據(jù)綁定 Web Forms - ArrayList 對(duì)象 Web Forms - Hashtable 對(duì)象 Web Forms - SortedList 對(duì)象 Web Forms - XML 文件 Web Forms - Repeater 控件 Web Forms - DataList 控件 Web Forms - 數(shù)據(jù)庫(kù)連接 Web Forms - 母版頁(yè) Web Forms - 導(dǎo)航 ASP.NET Razor Razor - C# 和 VB 代碼語(yǔ)法 Razor - C# 變量 Razor - C# 循環(huán)和數(shù)組 Razor - C# 邏輯條件 Razor - VB 變量 Razor - VB 循環(huán)和數(shù)組 Razor - VB 邏輯條件 WF 參考手冊(cè) Web Forms - HTML 服務(wù)器控件 ASP.NET HtmlAnchor 控件 ASP.NET HtmlButton 控件 ASP.NET HtmlForm 控件 ASP.NET HtmlGeneric 控件 ASP.NET HtmlImage 控件 ASP.NET HtmlInputButton 控件 ASP.NET HtmlInputCheckBox 控件 ASP.NET HtmlInputFile 控件 ASP.NET HtmlInputHidden 控件 ASP.NET HtmlInputImage 控件 ASP.NET HtmlInputRadioButton 控件 ASP.NET HtmlInputText 控件 ASP.NET HtmlSelect Control ASP.NET HtmlTable 控件 ASP.NET HtmlTableCell 控件 ASP.NET HtmlTableRow 控件 ASP.NET HtmlTextArea 控件 ASP.NET AdRotator 控件 ASP.NET AdRotator AdvertisementFile 屬性 ASP.NET AdRotator Target 屬性 ASP.NET Button 控件 ASP.NET Button CausesValidation 屬性 ASP.NET Button OnClientClick 屬性 ASP.NET Button PostBackUrl 屬性 ASP.NET Button Text 屬性 ASP.NET Button UseSubmitBehavior 屬性 ASP.NET Button ValidationGroup 屬性 ASP.NET Calendar 控件 ASP.NET Calendar Caption 屬性 ASP.NET Calendar CaptionAlign 屬性 ASP.NET Calendar CellPadding 屬性 ASP.NET Calendar CellSpacing 屬性 ASP.NET Calendar DayHeaderStyle 屬性 ASP.NET Style 控件 ASP.NET BackColor 屬性 ASP.NET BorderColor 屬性 ASP.NET BorderStyle 屬性 ASP.NET BorderWidth 屬性 ASP.NET CssClass 屬性 ASP.NET Font 屬性 ASP.NET ForeColor 屬性 ASP.NET Height 屬性 ASP.NET Width 屬性 ASP.NET Calendar DayNameFormat 屬性 ASP.NET Calendar DayStyle 屬性 ASP.NET Calendar FirstDayOfWeek 屬性 ASP.NET Calendar NextMonthText 屬性 ASP.NET Calendar NextPrevFormat 屬性 ASP.NET Calendar NextPrevStyle 屬性 ASP.NET Calendar OtherMonthDayStyle 屬性 ASP.NET Calendar PrevMonthText 屬性 ASP.NET Calendar SelectedDate 屬性 ASP.NET Calendar SelectedDates 屬性 ASP.NET Calendar SelectedDayStyle 屬性 ASP.NET Calendar SelectionMode 屬性 ASP.NET Calendar SelectMonthText 屬性 ASP.NET Calendar SelectorStyle 屬性 ASP.NET Calendar SelectWeekText 屬性 ASP.NET Calendar ShowDayHeader 屬性 ASP.NET Calendar ShowGridLines 屬性 ASP.NET Calendar ShowNextPrevMonth 屬性 ASP.NET Calendar ShowTitle 屬性 ASP.NET Calendar TitleFormat 屬性 ASP.NET Calendar TitleStyle 屬性 ASP.NET Calendar TodayDayStyle 屬性 ASP.NET Calendar TodaysDate 屬性 ASP.NET Calendar VisibleDate 屬性 ASP.NET Calendar WeekendDayStyle 屬性 ASP.NET CalendarDay 控件 ASP.NET CalendarDay Date 屬性 ASP.NET CalendarDay DayNumberText 屬性 ASP.NET CalendarDay IsOtherMonth 屬性 ASP.NET CalendarDay IsSelectable 屬性 ASP.NET CalendarDay IsSelected 屬性 ASP.NET CalendarDay IsToday 屬性 ASP.NET CalendarDay IsWeekend 屬性 ASP.NET CheckBox 控件 ASP.NET CheckBox Checked 屬性 ASP.NET CheckBox Text 屬性 ASP.NET CheckBox TextAlign 屬性 ASP.NET CheckBoxList 控件 ASP.NET CheckBoxList CellPadding 屬性 ASP.NET CheckBoxList CellSpacing 屬性 ASP.NET CheckBoxList RepeatColumns 屬性 ASP.NET CheckBoxList RepeatDirection 屬性 ASP.NET CheckBoxList RepeatLayout 屬性 ASP.NET CheckBoxList TextAlign 屬性 ASP.NET DropDownList 控件 ASP.NET DropDownList SelectedIndex 屬性 ASP.NET HyperLink 控件 ASP.NET HyperLink ImageUrl 屬性 ASP.NET HyperLink NavigateUrl 屬性 ASP.NET HyperLink Target 屬性 ASP.NET HyperLink Text 屬性 ASP.NET Image 控件 ASP.NET Image AlternateText 屬性 ASP.NET Image ImageAlign 屬性 ASP.NET Image ImageUrl 屬性 ASP.NET ImageButton 控件 ASP.NET ImageButton CausesValidation 屬性 ASP.NET ImageButton ValidationGroup 屬性 ASP.NET ImageButton PostBackUrl 屬性 ASP.NET ImageButton ValidationGroup 屬性 ASP.NET Label 控件 ASP.NET LinkButton 控件 ASP.NET LinkButton OnClientClick 屬性 ASP.NET LinkButton PostBackUrl 屬性 ASP.NET LinkButton Text 屬性 ASP.NET LinkButton ValidationGroup 屬性 ASP.NET ListBox 控件 ASP.NET Rows 屬性 ASP.NET SelectionMode 屬性 ASP.NET ListItem 控件 ASP.NET ListItem Enabled 屬性 ASP.NET ListItem Selected 屬性 ASP.NET ListItem Text 屬性 ASP.NET ListItem Value 屬性 ASP.NET Literal 控件 ASP.NET Literal Text 屬性 ASP.NET Panel 控件 ASP.NET Panel BackImageUrl 屬性 ASP.NET Panel DefaultButton 屬性 ASP.NET Panel Direction 屬性 ASP.NET Panel GroupingText 屬性 ASP.NET Panel HorizontalAlign 屬性 ASP.NET Panel ScrollBars 屬性 ASP.NET Panel Wrap 屬性 ASP.NET PlaceHolder 控件 ASP.NET RadioButton 控件 ASP.NET RadioButtonList 控件 ASP.NET RadioButtonList CellPadding 屬性 ASP.NET RadioButtonList CellSpacing 屬性 ASP.NET RadioButtonList RepeatColumns 屬性 ASP.NET RadioButtonList RepeatDirection 屬性 ASP.NET RadioButtonList TextAlign 屬性 ASP.NET BulletedList BulletImageUrl 屬性 Web Forms - Web 服務(wù)器控件 ASP.NET Table 控件 ASP.NET BackImageUrl 屬性 ASP.NET Caption 屬性 ASP.NET CaptionAlign 屬性 ASP.NET CellPadding 屬性 ASP.NET CellSpacing 屬性 ASP.NET GridLines 屬性 ASP.NET HorizontalAlign 屬性 ASP.NET TableCell 控件 ASP.NET TableCell ColumnSpan 屬性 ASP.NET TableCell HorizontalAlign 屬性 ASP.NET TableCell RowSpan 屬性 ASP.NET TableCell Text 屬性 ASP.NET TableCell Wrap 屬性 ASP.NET TableRow 控件 ASP.NET TableRow HorizontalAlign 屬性 ASP.NET TableRow TableSection 屬性 ASP.NET TableRow VerticalAlign 屬性 ASP.NET TextBox 控件 ASP.NET TextBox AutoCompleteType 屬性 ASP.NET TextBox AutoPostBack 屬性 ASP.NET TextBox Columns 屬性 ASP.NET TextBox MaxLength 屬性 ASP.NET TextBox ReadOnly 屬性 ASP.NET TextBox Rows 屬性 ASP.NET TextBox Text 屬性 ASP.NET TextBox TextMode 屬性 ASP.NET TextBox Wrap 屬性 ASP.NET XML 控件 ASP.NET XML DocumentSource 屬性 Web Forms - Validation 服務(wù)器控件 ASP.NET CompareValidator 控件 ASP.NET CustomValidator 控件 ASP.NET RangeValidator 控件 ASP.NET RegularExpressionValidator 控件 ASP.NET RequiredFieldValidator 控件 ASP.NET ValidationSummary 控件 ASP.NET BulletedList 控件 ASP.NET BulletedList BulletStyle 屬性 ASP.NET BulletedList DisplayMode 屬性 ASP.NET BulletedList FirstBulletNumber 屬性 ASP.NET BulletedList Target 屬性 WP 參考手冊(cè) Web Pages - 類(lèi) Web Pages - WebSecurity 對(duì)象 WebSecurity 屬性 - CurrentUserId WebSecurity 屬性 -?CurrentUserName WebSecurity 屬性 - HasUserId WebSecurity 屬性 - IsAuthenticated WebSecurity - ChangePassword() WebSecurity - ConfirmAccount() WebSecurity - CreateAccount() WebSecurity - CreateUserAndAccount() WebSecurity - GeneratePasswordResetToken() WebSecurity - GetCreateDate() WebSecurity - GetPasswordChangeDate() WebSecurity - GetUserId() WebSecurity - InitializeDatabaseConnection() WebSecurity - IsConfirmed() WebSecurity - IsCurrentUser() WebSecurity - Login() WebSecurity - Logout() WebSecurity - RequireAuthenticatedUser() WebSecurity - RequireRoles() WebSecurity - RequireUser() WebSecurity - ResetPassword() WebSecurity - UserExists() Web Pages - WebMail 對(duì)象 Web Pages - 更多幫助器
テキスト

Web Pages - 頁(yè)面布局



通過(guò) Web Pages ,創(chuàng)建一個(gè)布局一致的網(wǎng)站是很容易的事。


一致的外觀

在因特網(wǎng)上,您會(huì)發(fā)現(xiàn)很過(guò)網(wǎng)站都具有一致的外觀和風(fēng)格:

  • 每個(gè)頁(yè)面有相同的頭部
  • 每個(gè)頁(yè)面有相同的底部
  • 每個(gè)頁(yè)面有相同的樣式和布局

通過(guò) Web Pages ,您能非常高效地做到這點(diǎn)。您可以把重復(fù)使用的內(nèi)容塊(比如頁(yè)面頭部和底部)寫(xiě)在一個(gè)單獨(dú)的文件中。

您還可以使用布局模板(布局文件)為站點(diǎn)的所有網(wǎng)頁(yè)定義一致的布局。


Content Blocks(內(nèi)容塊)

許多網(wǎng)站都有一些內(nèi)容是被顯示在站點(diǎn)的每個(gè)頁(yè)面中(比如頁(yè)面頭部和底部)。

通過(guò) Web Pages,您可以使用 @RenderPage() 方法從不同的文件導(dǎo)入內(nèi)容。

內(nèi)容塊(來(lái)自另一個(gè)文件)能被導(dǎo)入網(wǎng)頁(yè)中的任何地方。內(nèi)容塊可以包含文本,標(biāo)記和代碼,就像任何普通的網(wǎng)頁(yè)一樣。

將共同的頭部和底部寫(xiě)成單獨(dú)的文件,這樣會(huì)幫您節(jié)省大量的工作。您不必在每個(gè)頁(yè)面中書(shū)寫(xiě)相同的內(nèi)容,當(dāng)內(nèi)容有變動(dòng)時(shí),您只要修改頭部或者底部文件,就可以看到站點(diǎn)中的每個(gè)頁(yè)面的相應(yīng)內(nèi)容都已更新。

以下顯示了它在代碼中是如何呈現(xiàn)的:

實(shí)例

<html>
<body>
@RenderPage("header.cshtml")
<h1>Hello Web Pages</h1>
<p>This is a paragraph</p>
@RenderPage("footer.cshtml")
</body>
</html>
?

Layout Page(布局頁(yè))

在上一部分,您看到了,想在多個(gè)網(wǎng)頁(yè)中顯示相同內(nèi)容是非常容易的。

另一種創(chuàng)建一致外觀的方法是使用布局頁(yè)。一個(gè)布局頁(yè)包含了網(wǎng)頁(yè)的結(jié)構(gòu),而不是內(nèi)容。當(dāng)一個(gè)網(wǎng)頁(yè)(內(nèi)容頁(yè))鏈接到布局頁(yè),它會(huì)根據(jù)布局頁(yè)(模板)的結(jié)構(gòu)進(jìn)行顯示。

布局頁(yè)中使用 @RenderBody() 方法嵌入內(nèi)容頁(yè),除此之外,它與一個(gè)正常的網(wǎng)頁(yè)沒(méi)有什么差別。

每個(gè)內(nèi)容頁(yè)都必須以布局指令開(kāi)始。

以下顯示了它在代碼中是如何呈現(xiàn)的:

布局頁(yè):

<html>
<body>
<p>This is header text</p>
@RenderBody()
<p>&copy; 2012 W3CSchool. All rights reserved.</p>
</body>
</html>

任何網(wǎng)頁(yè):

@{Layout="Layout.cshtml";}

<h1>Welcome to shouce.ren</h1>

<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit,sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laborisnisi ut aliquip ex ea commodo consequat.
</p>
?

D.R.Y. - Don't Repeat Yourself(不要自我重復(fù))

通過(guò) Content Blocks(內(nèi)容塊)和 Layout Pages(布局頁(yè))這兩個(gè) ASP.NET 工具,您可以讓您的 Web 應(yīng)用程序顯示一致的外觀。

這兩個(gè)工具能幫您節(jié)省大量的工作,您不必再每個(gè)頁(yè)面上重復(fù)相同的信息。集中的標(biāo)記、樣式和代碼讓您的 Web 應(yīng)用程序更易于管理,更易于維護(hù)。


防止文件被瀏覽

在 ASP.NET 中,文件的名稱(chēng)以下劃線(xiàn)開(kāi)頭,可以防止這些文件在網(wǎng)上被瀏覽。

如果您不想讓您的內(nèi)容塊或者布局頁(yè)被您的用戶(hù)看到,可以重命名這些文件:

_header.cshtm

_footer.cshtml

_Layout.cshtml


隱藏敏感信息

在 ASP.NET 中,隱藏敏感信息(數(shù)據(jù)庫(kù)密碼、電子郵件密碼等等)最通用的方法是將這些信息保存在一個(gè)名為"_AppStart"的單獨(dú)的文件中。

_AppStart.cshtml

@{
WebMail.SmtpServer = "mailserver.example.com";
WebMail.EnableSsl = true;
WebMail.UserName = "username@example.com";
WebMail.Password = "your-password";
WebMail.From = "your-name-here@example.com";
}



前の記事: 次の記事: