主頁(yè) > 知識(shí)庫(kù) > asp.net中Post表單保存頁(yè)面狀態(tài)并輸出源碼的實(shí)現(xiàn)方法

asp.net中Post表單保存頁(yè)面狀態(tài)并輸出源碼的實(shí)現(xiàn)方法

熱門(mén)標(biāo)簽:山西防封卡電銷(xiāo)卡套餐 上海楊浦怎么申請(qǐng)申請(qǐng)400電話 浙江外呼系統(tǒng)怎么安裝 地圖標(biāo)注多個(gè)行程 銅川小型外呼系統(tǒng)運(yùn)營(yíng)商 陜西人工外呼系統(tǒng)哪家好 云南外呼電銷(xiāo)機(jī)器人系統(tǒng) 廈門(mén)商鋪地圖標(biāo)注 海外地圖標(biāo)注門(mén)市標(biāo)
Html頁(yè)面
復(fù)制代碼 代碼如下:

%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default"
ValidateRequest="false" %>
%@ Register Src="UserControl/Ucone.ascx" TagName="Ucone" TagPrefix="uc1" %>
!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 runat="server">
title>頁(yè)面提交后提取Html源碼(保持狀態(tài))/title>
script type="text/javascript">
function getAllCode_IE() {
document.getElementById("hid_html").value=document.documentElement.outerHTML;
}
function getAllCode_FireFox(){
return document.body.innerHTML.toString();
}
/script>
/head>
body>
form id="form1" runat="server">
div>
uc1:Ucone ID="Ucone1" runat="server" />
/div>
/form>
/body>
/html>

用戶控件
復(fù)制代碼 代碼如下:

%@ Control Language="C#" AutoEventWireup="true" CodeFile="Ucone.ascx.cs" Inherits="UserControl_Ucone" %>
asp:TextBox ID="txtName" runat="server">/asp:TextBox>
asp:Button ID="btnAdd" runat="server" Text="Add" />
input type="hidden" id="hid_html" name="hid_html" />
div id="div_inner_input" runat="server">
/div>

用戶控件后臺(tái):
復(fù)制代碼 代碼如下:

public partial class UserControl_Ucone : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
this.btnAdd.Attributes.Add("onclick", "return getAllCode_IE();");
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
this.btnAdd.Click += new EventHandler(btnAdd_Click);
}
void btnAdd_Click(object sender, EventArgs e)
{
this.div_inner_input.InnerText = Request.Form["hid_html"].ToString();
}
}

作者: Ruanyiniu(Ryan)
您可能感興趣的文章:
  • ASP.Net中表單POST到其他頁(yè)面的方法分享

標(biāo)簽:萊蕪 許昌 信陽(yáng) 朔州 常州 孝感 西雙版納 自貢

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《asp.net中Post表單保存頁(yè)面狀態(tài)并輸出源碼的實(shí)現(xiàn)方法》,本文關(guān)鍵詞  asp.net,中,Post,表單,保存,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《asp.net中Post表單保存頁(yè)面狀態(tài)并輸出源碼的實(shí)現(xiàn)方法》相關(guān)的同類(lèi)信息!
  • 本頁(yè)收集關(guān)于asp.net中Post表單保存頁(yè)面狀態(tài)并輸出源碼的實(shí)現(xiàn)方法的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章