ASP.NET
示例
第一个示例演示如何创建 FileUpload 控件,该控件将文件保存到代码中指定的路径。
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void UploadButton_Click(object sender, EventArgs e)
{
// Specify the path on the server to
// save the uploaded file to.
String savePath = @"c:\temp\uploads\";
// Before attempting to perform operations
// on the file, verify that the FileUpload
// control contains a file.
if (FileUpload1.HasFile)
{
// Get the name of the file to upload.
String fileName = FileUpload1.FileName;
// Append the name of the file to upload to the path.
savePath += fileName;
// Call the SaveAs method to save the
// uploaded file to the specified path.
// This example does not perform all
// the necessary error checking.
// If a file with the same name
// already exists in the specified path,
// the uploaded file overwrites it.
FileUpload1.SaveAs(savePath);
// Notify the user of the name of the file
// was saved under.
UploadStatusLabel.Text = "Your file was saved as " + fileName;
}
相关文档:
概念:当位于UpdatePanel控件外部的某个控件的特定事件被触发时就引发异步回送并局部更新UpdatePanel控件的内容。
它的好处是:我们只需把需要更新的数据控件放在UpdatePanel控件里,而不需要更新的控件我们就把它放在UpdatePanel控件的外面,如此一来,才可以有效的降低往返于WEB服务器的数据量,并顺势降低WEB服务 ......
<%=%>绑定CS文件中的变量,有值的属性,或者有返回值的方法,
<%#%>一般式放在数据控件中绑定数据源表中的字段
<%=%><%#%>区别:
前者 是在页面之中使用.属于一段代码.有=号的就相当于response.write()这功能.和asp一样.
后者 是在页面中的服务器数据控件中绑定数据源的字段 ......
如果你已经有较多的面向对象开发经验,跳过以下这两步:
第一步 掌握一门.NET面向对象语言,C#或VB.NET 我强烈反对在没系统学过一门面向对象(OO)语言的前提下去学ASP.NET。 ASP.NET是一个全面向对象的技术,不懂OO,那绝对学不下去!
第二步 对.NET Framework类库有一定的了解 可以通过开发Windows Fo ......
<mce:script language=javascript><!--
//注册命名空间
Type.registerNamespace("Demo");
Demo.Message=function(content,publishTime)
{
this._content = content;
this._publishTime = publishTime;
}
Dem ......