webform里面我写了一个aspx文件
aspx上有个TextBox
而TextBox中的值已从数据库读取
TextBox旁边有个Button
需要点击Button的时候
能够将TextBox中的值保存到
客户端客户所指定的位置
功能类似与winform中的FileSaveAs控件
我在线急等,请诸位大侠帮帮忙
小弟感激不尽
aspx上有个TextBox
而TextBox中的值已从数据库读取
TextBox旁边有个Button
需要点击Button的时候
能够将TextBox中的值保存到
客户端客户所指定的位置
功能类似与winform中的FileSaveAs控件
我在线急等,请诸位大侠帮帮忙
小弟感激不尽
后面两个参数可以省略
我已经试过了
是将整个aspx以html方式存储到客户端
但我只需要aspx中TextBox的值啊
在新窗口上写
<script language=javascript defer>
document.body.innerHTML=window.opener.document.getElementById("textboxId").value
document.execCommand("saveAs")
</script>
{
string value = this.TextBox1.Text.ToString(); HttpResponse response = HttpContext.Current.Response; response.AddHeader("Content-Disposition","attachment;filename=aa.txt");
response.ContentType = "application/octet-stream";
response.Write(value ); response.End();
}
我已经实现的我需要的功能
分数一定如实奉上
再次感谢lizhongbin(闪客)
晚上写的能跑动的例子
马上要过年了
祝你们在新的一年里
万事如意 事事顺心 大吉大利 步步高升
祝天下所有的程序员们
身体健康 吃嘛儿嘛儿香
我是刚刚注册上的CSDN
不知道怎么给分
给分旁边的那个码的文本框
不知道输入什么(PS:汗!)
请告诉我
谢谢
<input name="haha" value="22">
<script language=javascript>
var win=window.open("about:blank","","height=100,width=400,top=-500,left=-500,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no")//开新窗口
win.document.write(document.getElementById("haha").value)//保存到窗口里
win.document.write("<script language=javascript>document.execCommand('Saveas',false,'.txt');window.close()</scri"+"pt>");
</script>