All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
让SQL Server为工作负载高峰提前做好准备_[SQL Server教程]
ASP.NET:一段比较经典的多线程学习代码_[Asp.Net教程]
Asp.NET大文件上传组件开发总结(三)---处理文件内容_[Asp.Net教程]
Linux操作系统下PHP服务器安全配置技巧_php资料_编程技术
PHP动态网站开发中常用的8个小技巧_php资料_编程技术
ASP.NET,配置文件层次结构和继承_.net资料_编程技术
根据html页面模板动态生成html页面
.NET内置对象之Request对象_[Asp.Net教程]
SQL,server2000简介_mssql学习_编程技术
Delphi自动启动的多媒体光盘程序
Reading number is top 10 pictures
Extremely rare TianShan Mountains snow lotus1
可爱的狗熊们
The dog buy the ham oneself
The Soviet union swimsuit exposure in the 70 year1
NeedWallpaper9
美女
The money of more than 100 countries and regions1
某某人向找小三的人宣战了
玩手机对身体不好
So beauty, will let you spray blood7
Download software ranking
Detective task-the top secret prostitution files
Dance with duck(male prostitution)
Rio big adventure
网络管理员第三版
Professional killers2 data package
Call Of Duty2
天龙八部最新服务端
Kung.Fu.Panda.2
Boxer's Top ten classic battle6
Unix video tutorial18
qq published in(发表于) 2014/7/9 1:37:55 Edit(编辑)
asp.net2.0标准服务器控件典型应用

asp.net2.0标准服务器控件典型应用

asp.net2.0标准服务器控件典型应用

标准服务器控件典型应用

每个网页中都是由许多的标准控件组成的,开发人员利用这些标准控件来实现各种功能。下面以注册学生信息页为例,对标准服务器控件进行介绍。运行结果如图2所示。



图1 标准控件的应用示例运行结果

程序开发步骤如下所示。

(1)新建一个网站,将其命名为13_01,默认主页名称为dxyy.aspx。

(2)dxyy.aspx页面涉及的控件如表1所示。



表1 dxyy.aspx页面用到的控件

页面中主要控件属性设置如下。

RadioButton控件属性设置:分别将两个RadioButton控件的ID属性设为“rbtnSex1”和“rbtnSex1”,并将两个RadioButton控件GroupName属性设为“Sex”。

Button控件属性设置:分别将Button控件的ID属性设为“btnSubmit”和“btnShow”,并将TextBox属性设为“提交”和“显示”。

(3)主要程序代码如下。

单击FileUpLoad控件的【浏览】按钮选择照片的路径,并单击【显示】按钮将照片保存在服务器中的指定位置并显示在Image控件上,代码如下:

protected void btnShow_Click(object sender, EventArgs e)

{

string name = this.fulImage .FileName;//获取上载文件的名称

if (name != "")

{

path = Server.MapPath("~/Image/");

this.fulImage.PostedFile.SaveAs(path + name);//将文件保存在相应的路径下

this.Image1.ImageUrl = path + name;//将图片显示在Image控件上

}

}

单击【提交】按钮将用户填写的信息在网页上输出,代码如下:

protected void btnSubmit_Click(object sender, EventArgs e)

{

string sex ="";

string hobby = "";

int flag=0;

Response.Write("学生信息
");

Response.Write("姓名:" + this.txtName.Text + "
");

if (this.rbtnSex1.Checked)

{

sex = "男";

}

else

{

sex = "女";

}

Response.Write("性别:" + sex + "
");

f (this.chk1.Checked)

{

hobby = this.chk1.Text;

flag = 1;

}

if (this.chk2.Checked)

{

if (flag == 1)

{

hobby += ("、" + this.chk2.Text);

}

else

{

hobby += this.chk2.Text;

}

flag = 2;

}

if (this.chk3.Checked)

{

if (flag == 1||flag==2)

{

hobby += ("、" + this.chk3.Text);

}

else

{

hobby +=this.chk3.Text;

}

}

Response.Write("爱好:" + hobby + "
");

Response.Write("相片位置:" + path );

完整程序代码如下:

★★★★★dxyy.aspx页面设计文件完整程序代码★★★★★

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="dxyy.aspx.cs" Inherits="dxyy"%>







典型应用















学生基本信息








姓名:






















性别:







添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.