您目前尚未登陆,请选择【登陆】或【注册
首页->上传下载->Asp.net+Flash实现无刷新上传>>Default.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:Asp.net+Flash实现无刷新上传
当前文件:文件类型 FlashUpload/Default.aspx.cs打开代码结构图
普通视图
		            
1using System; 2using System.Data; 3using System.Configuration; 4using System.Web; 5using System.Web.Security; 6using System.Web.UI; 7using System.Web.UI.WebControls; 8using System.Web.UI.WebControls.WebParts; 9using System.Web.UI.HtmlControls; 10 11//该源码下载自www.51aspx.com(51aspx.com) 12public partial class _Default : System.Web.UI.Page 13{ 14 protected void Page_Load(object sender, EventArgs e) 15 { 16 // allows the javascript function to do a postback and call the onClick method 17 // associated with the linkButton LinkButton1. 18 string jscript = "function UploadComplete(){"; 19 jscript += string.Format("__doPostBack('{0}','');", LinkButton1.ClientID.Replace("_", "$")); 20 jscript += "};"; 21 Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "FileCompleteUpload", jscript, true); 22 } 23 protected string GetFlashVars() 24 { 25 // Adds query string info to the upload page 26 // you can also do something like: 27 // return "?" + Server.UrlEncode("CategoryID="+CategoryID); 28 // we UrlEncode it because of how LoadVars works with flash, 29 // we want a string to show up like this 'CategoryID=3&UserID=4' in 30 // the uploadPage variable in flash. If we passed this string withou 31 // UrlEncode then flash would take UserID as a seperate LoadVar variable 32 // instead of passing it into the uploadPage variable. 33 // then in the httpHandler we get the CategoryID and UserID values from 34 // the query string. See Upload.cs in App_Code 35 // From 51aspx.com 36 return "?" + Server.UrlEncode(Request.QueryString.ToString()); 37 } 38 protected void LinkButton1_Click(object sender, EventArgs e) 39 { 40 // Do something that needs to be done such as refresh a gridView 41 // say you had a gridView control called gvMyGrid displaying all 42 // the files uploaded. Refresh the data by doing a databind here. 43 // gvMyGrid.DataBind(); 44 } 45} 46
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:Asp.net+Flash实现无刷新上传
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号