<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="WebApplication1.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript (ECMAScript)">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<FONT face="宋体">
<asp:TextBox id="TextBox1" style="Z-INDEX: 101; LEFT: 164px; POSITION: absolute; TOP: 190px" runat="server" Width="204px" Height="25px"></asp:TextBox>
<asp:Button id="Button1" style="Z-INDEX: 102; LEFT: 386px; POSITION: absolute; TOP: 188px" runat="server" Width="78px" Height="25px" Text="Button"></asp:Button>
<asp:DropDownList id="DropDownList1" style="Z-INDEX: 103; LEFT: 29px; POSITION: absolute; TOP: 192px" runat="server" Width="130px" Height="22px"></asp:DropDownList>
</FONT>
</form>
</body>
</HTML>
(后台CS代码)
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Xml ;
namespace WebApplication1
{
/// <summary>
/// Summary description for WebForm1.
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.DropDownList DropDownList1;
protected System.Web.UI.WebControls.Button Button1;
public WebForm1()
{
Page.Init += new System.EventHandler(Page_Init);
}
private void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
{
//打开某文件(假设WEB。CONFIG在根目录中)
string filename=Server.MapPath("/") + @"\web.config";
XmlDocument xmldoc= new XmlDocument();
xmldoc.Load(filename);
XmlNodeList topM=xmldoc.DocumentElement.ChildNodes;
foreach(XmlElement element in topM)
{
if(element.Name.ToLower()=="appsettings")
{
XmlNodeList _node=element.ChildNodes;
if ( _node.Count >0 )
{
DropDownList1.Items.Clear();
foreach(XmlElement el in _node)
{
DropDownList1.Items.Add(el.Attributes["key"].InnerXml);
}
}
}
}
}
}
private void Page_Init(object sender, EventArgs e)
{
InitializeComponent();
}
#region Web Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
相关资讯
-
document.cookie:客户端操作cookie
我们已经知道,在 document 对象中有一个 cookie 属性。但是 Cookie 又是什么?“某些 Web 站点在您的硬盘上用很小的文本文件存储了一些信息,这些文件就称为 Cookie。”—— MSIE 帮助。一般来说,Cookies 是 CGI 或类似,比 HTML …
2019/4/12 8:18:11 -
用ASP实现分级权限控制
本文实现的是一个帐务管理系统中分级权限的控制,程序使用ASP和JavaScript编写,在装有IIS4.0的win NT服务器上运行,速度快,易维护。 权限级别划分如下: ①、院长和财务科长:不能输入,可以无限制查询、统计; ②、副院长:不能输入,可以查询、统计其分管部…
2019/4/12 8:18:11 -
ASP实现Rewrite模拟生成静态页效
以前刚刚懂404.asp的时候,曾经幻想把所有程序代码写到404.asp中,实现一个模拟生成静态网页的站,如果程序小还可以,用404.asp实现Rewrite还是一个不错的选择,如果程序代码多达100000行,恐怕就要开始爬了 直到看到asp的Server.Transfer,用404模拟生成静态页的站的念…
2019/4/12 8:18:11 -
ASP随机涵数生成100条8位字母和数字混合密码
<%for i = 1 to 100%><%Randomizepass=""Do While Len(pass)<8 随机密码位数num1=CStr(Chr((57-48)*rnd+48)) 0~9num2=CStr(Chr((122-97)*rnd+97)) a~zpass=pass&num1&num2loop原创:www.devdao.com%><%=pass%><br><%next…
2019/4/12 8:18:11

共有条评论 网友评论