asp.net支持大文件上传 NeatUpload
1.在工具箱中添加Brettle.Web.NeatUpload.dll,可以看到工具箱中出现InputFile等控件。
2.复制文件夹NeatUpload到根目录.
3.拖放使用上传控件InputFile和进度条ProgressBar,添加上传文件的按钮.aspx页面代码如下:
<body>
<form id="form1" runat="server">
<div>
<upload:InputFile id="AttachFile" runat="server"></upload:InputFile>
<asp:Button ID="Upload" runat="server" Text="Upload"
OnClientClick="ToggleVisibility('ProgressBar','on')"
OnClick="Upload_Click"/>
<div id="ProgressBar" style="display:none;">
<upload:progressbar id="pbProgressBar" runat="server" Inline="true"
Width="500px" Height="100"> </upload:progressbar>
</div>
</div>
</form>
</body>
4.添加脚本代码ToggleVisiblity函数到页面上如下:
<script type="text/javascript" language="javascript">
function ToggleVisibility(id, type)
{
el = document.getElementById(id);
if(el.style)
{
if(type == 'on')
{
el.style.display = 'block';
}
else
{
el.style.display = 'none';
}
}
else
{
if(type == 'on')
{
el.display = 'block';
}
else
{
el.display = 'none';
}
}
}
</script>
5.给上传文件的按钮添加事件Upload_Click
protected void Upload_Click(object sender, EventArgs e)
{
string FileName = this.AttachFile.FileName;//获取上传文件的全路径
string ExtenName = System.IO.Path.GetExtension(FileName);//获取扩展名
string SaveFileName =
System.IO.Path.Combine(Request.PhysicalApplicationPath,
DateTime.Now.ToString("yyyyMMddhhmm") + ExtenName);//合并两个路径为上传到服务器上的全路径
if (this.AttachFile.ContentLength > 0)
{
try
{
this.AttachFile.MoveTo(SaveFileName, Brettle.Web.NeatUpload.MoveToOptions.Overwrite);
}
catch (Exception ex)
{
throw ex;
}
}
}
6.在配置文件web.config中添加http模块声明:
<ht
相关文档:
1. Repeater需要手动去绑定数据。 意思是说我们要在View当中写 服务端代码,先从ViewData中取得数据,再去绑定到Repeater。
2. 如果一个页面用到n+1个Repeater,那会不会疯掉? 而且要给每一个Repeater指定 Id,必去绑数据,头痛啊!!!
&nb ......
ASP.NET中,经常会使用到templates(模版)功能,比如在datagrid,datalist,repeater等控件中,使用templates,将会大大增强其功能。以往,我们一般是在设计程序时,就已经设置好控件中的模版是怎样的了。但是,有的时候,可能我们需要动态加载模版,比如,当你要求你的应用程序的界面风格随着用户的需求而变化时,你就需� ......
把我做第一次做系统时对重填按钮的实现记录如下:
第一次用ImageButton可以设置背景图片,然后在后台的Click事件中写如下
this.TxtCallNo.Text = "";
this.TxtCaller.Text = "";
this.TxtTranDate.Text = "";
this.TxtTranLimit.Text = "";
this.TxtTra ......
环境:asp.net +oracle9+windows2003
在本地测试网站完全没有问题。但是一上传到服务器就出问题了,数据库无法连接。由于远程没有VS环境,所以无法调试。真是费了牛劲才找到解决方案:
Problem Description ------------------- When running an application that connects to Oracle and uses the Authenticated ......
需求
如下面的项目结构,我们会在Default.aspx页面中需要传递两个值到SilverlightTestPage.aspx页面,并且需要在SilverlightTestPage.aspx页面所宿主的Silverlight应用程序中获取并显示:
1.先修改page 的构造函数
public Page(string passText)
{
InitializeComponent();
& ......