国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

asp.net頁面?zhèn)髦禍y(cè)試實(shí)例代碼_.Net教程

2024-07-10 12:52:42
字體:
供稿:網(wǎng)友

推薦:DataGridView - DataGridViewCheckBoxCell的使用介紹
Datagridview是.net中最復(fù)雜的控件,由于人們對(duì)表格的格式要求多種多樣,所以編寫一個(gè)通用的Datagridview(類似JSF中的datatable)非常困難的。 Datagridview中,用戶可以對(duì)行、列、單元格進(jìn)行編程。如行中可以插入下拉列表、復(fù)選框、編輯框、單選框等多種控件。每種控

WebForm_1.aspx內(nèi)容如下:

復(fù)制代碼 代碼如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm_1.aspx.cs" Inherits="頁面?zhèn)髦?WebForm_1" %>
<!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></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Table ID="TableLogin" runat='server'>
<asp:TableRow>
<asp:TableCell><label>用戶名:</label></asp:TableCell>
<asp:TableCell><asp:TextBox ID="UserName" runat="server" Width="150px"></asp:TextBox></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell><label>密碼:</label></asp:TableCell>
<asp:TableCell><asp:TextBox ID="PassWord" runat="server" Width="150px"></asp:TextBox></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell><label>驗(yàn)證密碼:</label></asp:TableCell>
<asp:TableCell><asp:TextBox ID="ConfimPWD" runat="server" Width="150px"></asp:TextBox></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell><asp:Button ID="Confirm" runat="server" Text="確認(rèn)" Width="50px" OnClick="Confirm_Click" /></asp:TableCell>
</asp:TableRow>
</asp:Table>
</div>
</form>
</body>
</html>


WebForm_2.aspx頁面如下:

復(fù)制代碼 代碼如下:
<%@ Reference Page="~/WebForm_1.aspx" %>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm_2.aspx.cs" Inherits="頁面?zhèn)髦?WebForm_2" %>
<!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></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>


WebForm_1.aspx.cs文件如下:

復(fù)制代碼 代碼如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace 頁面?zhèn)髦?
{
public partial class WebForm_1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
public string un//得到用戶名
{
get
{
return UserName.Text;
}
}
public string pwd//得到密碼
{
get
{
return PassWord.Text;
}
}
public string conpwd//得到確認(rèn)密碼
{
get
{
return ConfimPWD.Text;
}
}
/// <summary>
/// 向WebForm_2.aspx頁面?zhèn)髦?
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Confirm_Click(object sender, EventArgs e)
{
//1:QueryString頁面?zhèn)髦?
//string url = "WebForm_2.aspx?un=" + UserName.Text + "&userpassword=" + PassWord.Text + "&conPwd=" + ConfimPWD.Text;
//Response.Redirect(url);
//2:Session傳值
//Session["un"] = UserName.Text;
//Session["pwd"] = PassWord.Text;
//Session["conpwd"] = ConfimPWD.Text;
//Server.Transfer("WebForm_2.aspx");
//3:使用cookie對(duì)象傳值
//HttpCookie cookie_name = new HttpCookie("un");
//cookie_name.Value = UserName.Text;
//HttpCookie cookie_pwd = new HttpCookie("pwd");
//cookie_pwd.Value = PassWord.Text;
//HttpCookie cookie_conpwd = new HttpCookie("conpwd");
//cookie_conpwd.Value = ConfimPWD.Text;
//Response.AppendCookie(cookie_name);
//Response.AppendCookie(cookie_pwd);
//Response.AppendCookie(cookie_conpwd);
//Server.Transfer("WebForm_2.aspx");
//4:使用application對(duì)象傳值,類似session傳值,作用范圍全局所有用戶
//Application["un"] = UserName.Text;
//Application["pwd"] = PassWord.Text;
//Application["conpwd"] = ConfimPWD.Text;
//Response.Redirect("WebForm_2.aspx");
Server.Transfer("WebForm_2.aspx");
}
}
}

分享:asp.net中javascript的引用(直接引入和間接引入)
Asp.net 中引入Javascript 的方法有很多。在做牛腩的時(shí)候主要講了兩種。 個(gè)人認(rèn)為可以分為直接引入,和間接引入。 一、直接引入 。在前臺(tái)頁面調(diào)用自定義的javascript 函數(shù): 1、打開前臺(tái)頁面在 head 元素之間加入 script 元素,將 type 元素設(shè)置為 text/javascript 。然

共2頁上一頁12下一頁
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 福建省| 富裕县| 庆元县| 永平县| 乐昌市| 定安县| 台山市| 怀化市| 高邑县| 乳山市| 长阳| 运城市| 河西区| 五峰| 仁怀市| 咸阳市| 玛纳斯县| 土默特右旗| 涿鹿县| 威信县| 东明县| 锡林浩特市| 布尔津县| 绍兴市| 瑞丽市| 南郑县| 历史| 辽阳县| 玉田县| 天镇县| 嘉兴市| 绥宁县| 莒南县| 南城县| 博兴县| 陆良县| 长泰县| 澄迈县| 万源市| 漳州市| 驻马店市|