免费视频淫片aa毛片_日韩高清在线亚洲专区vr_日韩大片免费观看视频播放_亚洲欧美国产精品完整版

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
Button.PostBackUrl 屬性

下面的代碼示例演示如何使用 PostBackUrl 屬性執(zhí)行跨頁面發(fā)送。 當(dāng)用戶單擊 Button 控件時(shí),頁面會(huì)將文本框中輸入的值發(fā)送到 PostBackUrl 屬性指定的目標(biāo)頁。 若要運(yùn)行此示例,您還必須在本代碼示例所在的目錄下創(chuàng)建目標(biāo)頁文件。 目標(biāo)頁的代碼將在下一個(gè)示例中提供。

 
<%@ page language="VB" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head id="head1" runat="server">  <title>Button.PostBackUrl Example</title></head><body>      <form id="form1" runat="server">    <h3>Button.PostBackUrl Example</h3>    Enter a value to post:    <asp:textbox id="TextBox1"       runat="Server">    </asp:textbox>    <br /><br />    <asp:button id="Button1"       text="Post back to this page"      runat="Server">    </asp:button>    <br /><br />    <asp:button id="Button2"      text="Post value to another page"       postbackurl="Button.PostBackUrlPage2vb.aspx"       runat="Server">    </asp:button>  </form></body></html>

下面的代碼示例演示如何使用 Page.PreviousPage 屬性訪問使用 PostBackUrl 屬性從其他頁發(fā)送的值。 該頁獲取從上一頁發(fā)送的字符串,并將其顯示給用戶。 如果嘗試直接運(yùn)行此代碼示例,則會(huì)發(fā)生錯(cuò)誤,因?yàn)?text 字段的值將為 Nothing 正確的做法是使用此代碼創(chuàng)建一個(gè)目標(biāo)頁,并將目標(biāo)頁文件與上一示例的代碼放在同一目錄下。 目標(biāo)頁文件名必須與上一示例中為 PostBackUrl 屬性指定的值相對(duì)應(yīng)。 當(dāng)運(yùn)行上一示例的代碼時(shí),此頁將在發(fā)生跨頁面發(fā)送時(shí)自動(dòng)執(zhí)行。

安全說明

此示例有一個(gè)接受用戶輸入的文本框,這是一個(gè)潛在的安全威脅。 默認(rèn)情況下,ASP.NET 網(wǎng)頁驗(yàn)證用戶輸入是否不包含腳本或 HTML 元素。 有關(guān)更多信息,請(qǐng)參見腳本侵入概述

 
<%@ page language="VB" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server">  Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)    Dim text As String    ' Get the value of TextBox1 from the page that posted    ' to this page.    text = CType((PreviousPage.FindControl("TextBox1")), TextBox).Text    ' Check for an empty string.    If Not (text = "") Then      PostedLabel.Text = "The string posted from the previous page is " _                         & text & "."    Else      PostedLabel.Text = "An empty string was posted from the previous page."    End If  End Sub</script><html xmlns="http://www.w3.org/1999/xhtml" ><head id="head1" runat="server">  <title>Button.PostBackUrl Target Page Example</title></head><body>  <form id="form1" runat="server">    <h3>Button.PostBackUrl Target Page Example</h3>    <br />    <asp:label id="PostedLabel"       runat="Server">    </asp:label>    </form></body></html>
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
ASP.Net TextBox里面實(shí)現(xiàn)回車觸發(fā)按鈕事件
asp.net 2.0中不同web控件之間的相互調(diào)用
asp.net生成靜態(tài)頁的兩種方法
ASP.NET 中直接使用C# 動(dòng)態(tài)修改CSS樣式
使用ASP.NET發(fā)送HTML格式郵件
標(biāo)題:ASP.NET 2.0服務(wù)器控件與form runat=server標(biāo)記
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服