黑色微笑学asp.net(第一个.net程序)
黑色微笑学asp.net(第一个.net程序)
先看效果(加颜色纯属为了看清楚一点):
执行前:
执行后:
再看一下代码:
前台:
<body bgcolor="#ff00ff">
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server" ForeColor="Black"></asp:TextBox>
<strong><asp:Label ID="Label1" runat="server" Width="219px" ForeColor="Black"></asp:Label></strong>
<br />
<br />
<asp:Button ID="Button1" runat="server" CausesValidation="False" OnClick="Button1_Click"
Text="按钮" Width="124px" /></div>
</form>
</body>
后台:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class hswxjc_diyi : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = TextBox1.Text.Trim();
}
}
如果想执行后文本框上的文字清空就多加一句代码就可以了:
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = TextBox1.Text.Trim();
TextBox1.Text = "";
}
理解:
Label1.Text:是Label1控键的文字,
TextBox1.Text:是TextBox1控键的文字
Trim() :返回删除了前导空格和尾随空格的字符表达式。
相关文档:
在Web编程过程中,存在着很多安全隐患。比如在以前的ASP版本中,Cookie为访问者和编程者都提供了方便,并没有提供加密的功能。打开IE浏览器,选择“工具”菜单里的“Internet选项”,然后在弹出的对话框里单击“设置”按钮,选择“查看文件”按钮,在弹出的窗口中,就会显示硬盘里 ......
1、DateTime 数字型
System.DateTime currentTime=new System.DateTime();
1.1 取当前年月日时分秒
currentTime=System.DateTime.Now;
1.2 取当前年
int 年=currentTime.Year;
1.3 取当前月
int 月=currentTime.Month;
1.4 取当前日
int 日=currentTime.Day;
1.5 取当前时
int 时=currentTime.Hour ......
使用Ajax无刷新上传文件是当前比较流行的功能。借助JQuery强大的插件,现在已经可以很容易了。
首先导入js文件jquery.ajaxfileupload.js。此插件的原理是在文档中创建iframe和form然后在将文件上传到服务器。
1 <html xmlns="http://www.w3.org/1999/xhtml">
2 <head id="Head ......
今天要记录的是一篇关于局部刷新的,刚做网页的时候,每实现网页中的一个功能,都要刷新整个页面,感觉很烦人,严重影响了网站效率,而且整个网页刷新还会造成很多其他问题,所以就到网上查了些局部刷新的东西,并在做项目中使用了,挺好用的,也很简单,下面我就简单写两种用法:
1.这个做起来比较简单,主要依靠一个upda ......