如何使用数据绑定控件实现不换页提交数据?
发布时间:2010-05-16 15:17:00
如何使用数据绑定控件实现不换页提交数据?
Chunfeng.html
' 提交页面
< html>
< head>
< title> 本页提交 - aspxhome.com< /title>
< /head>
< !--DataSource is Data Binding control-->
< object classid="clsid:333C7BC4-460F-11D0-BC04-0080C7055A83" id="DataSource" VIEWASTEXT>
< param NAME="UseHeader" VALUE="True">
< param NAME="FieldDelim" VALUE=",">
< param NAME="DataURL" VALUE="ProcessData.asp?ID=0">
< /object>
< script for=DataSource event=ondatasetcomplete>
Name.value = "";
Age.value = "";
Age.disabled = true;
outputButton.disabled = true;
< /script>
< script>
var rowindex = 0;
function clickTR()
{
var srcElement = event.srcElement;
while(srcElement.tagName != "TR")
{
srcElement = srcElement.parentElement;
}
rowindex = srcElement.rowIndex;
Name.value = srcElement.cells(0).innerText;
Age.value = srcElement.cells(1).innerText;
Age.disabled = false;
outputButton.disabled = false;
}
function submitData()
{
var rs = DataSource.recordset;
rs.AbsolutePosition = rowindex;
if(rs("Name").value == Name.value && rs("Age").value == Age.value)
{
alert("Data no change"); return;
}
var szReturn;
szReturn = "ProcessData.asp?Name=" + Name.value + "&ID=" + rs("ID").value + "&Age=" + Age.value;
DataSource.DataURL = szReturn;
DataSource.reset();
outputButton.disabled = true;
}
< /script>
< body>
< table datasrc=#DataSource CELLPADDING="0" CELLSPACING="0" BORDER="1" WIDTH="100%">
< thead>
< th>姓名< /th>
< th>年龄< /th>
< /thead>
< tr style="Cursor:Hand" onclick="clickTR();" onmouseover="this.style.backgroundColor='silver';"
onmouseout="this.style.backgroundColor='white';">
< td><span datafld=Name>< /td>
< td><span datafld=Age>< /td>
< /tr>
< /table>
< hr>
< table width=100%>
< tr>
< td width=30%>姓名</td>
< td width=30%>年龄</td>
< td width=100%> </td>
< /tr>
< tr>
< td width=30%>< input style="width:100%" id=Name disabled>< /td>
< td width=30%>< input style="width:100%" id=Age disabled>< /td>
< td width=100%>< input type=button value="现在提交" id= outputButton disabled on click="submitData( );">< /td>
< /tr>
< /table>
< /body>
< /html>
ProcessData.asp
' 数据处理
< %@ Language=VBScript %>
< %
dim id
dim enter
enter = chr(10)
id = request.querystring("ID")
set d = server.createobject("scripting.filesystemobject")
if id < > 0 then
set read = d.opentextfile("c:\inetpub\wwwroot\test\Data.csv ")
set write = d.Createtextfile("c:\inetpub\wwwroot\test\ Data1.csv ")
dim index
dim string
id = id + 1
index = 1
while not read.AtEndOfStream
if index = id then
dim name
dim age
name = request.querystring("name")
age = request.querystring("age")
string = id - 1 & "," & name & "," & age
write.WriteLine(string)
read.ReadLine
else
write.writeLine(read.ReadLine)
end if
index = index + 1
wend
read.Close
write.Close
d.CopyFile "c:\inetpub\wwwroot\test\Data1.csv",
"c:\inetpub\wwwroot\test\ Data.csv "
d.DeleteFile "c:\inetpub\wwwroot\test\ Data1.csv "
end if
set file = d.opentextfile("c:\inetpub\wwwroot\test\ Data.csv ")
while not file.AtEndOfStream
Response.write (file.ReadLine)
Response.write enter wend file.Close %>
Data.csv
' 数据文件
ID:int,Name:string,Age:int
1,Victor, 23
2,Bill,31
3,kenny,31
4,hunter,24
猜你喜欢
- 文件操作是开发中经常遇到的场景,那么如何判断一个对象是文件对象呢?下面我们总结了3种常见的方法。方法1:比较类型第一种方法,就是判断对象的t
- 准备工作:python:https://www.python.org/downloads/Dev-C++:https://sourcefor
- 1.前期准备用户models.pyclass User(models.Model): username = mod
- 1.基本信息? Pandas 的 apply() 方法是用来调用一个函数(Python method),让此函数对数据对象进行批量处理。Pa
- 目录selenium介绍selenium原理Selenium安装部署步骤1. 准备好python环境:2. 下载selenium并安装:3.
- python自定义异常实例详解 本文通过两种
- tf.keras.layers模块中的函数from __future__ import print_function as _print_f
- Windows环境: (1)离线安装 首先在线搜索并下载你需要的第三方库:网址https
- 针对这种情况,人工智能自动SQL优化工具应运而生。现在我就向大家介绍这样一款工具:SQLTuning for SQL Server。1. S
- Expression定义 IE5及其以后版本支持在CSS中使用expression,用来把CSS属性和Javascript表达式关联起来,这
- 关于最近要在python下做可视化界面的设计,想到之前用QtDesigner来画界面很是方便,当时画完之后都要手动在终端输入 pyuic5
- python现在的版本,主要是python2和python3两个大版本,这两个版本有很大的不同。当我们在自己电脑上同时安装了python2.
- Python docx module for Word or WPS processing本文是通过docx把word中的表格中的某些已填好
- 0. 学习目标在顺序存储方式中,根据数据元素的序号就可随机存取表中任何一个元素,但同时在插入和删除运算需要移动大量的元素,造成算法效率较低。
- 本文实例讲述了golang简单位运算。分享给大家供大家参考,具体如下:// http://play.golang.org/p/idG7Ri_
- zip()的作用先看一下语法:zip(iter1 [,iter2 [...]]) —> zip objectPython的内置help
- 前面说到了urllib2的简单入门,下面整理了一部分urllib2的使用细节。1.Proxy 的设置urllib2 默认会使用环境变量 ht
- 以下笔记是我在 xue.cn 学习群之数据分析小组所整理分享的心得。相关背景是:我选择中文词频统计案例作为考察大家python基础功掌握程度
- 先修改Master(10.1.123.197)的 my.cnf 配置在 [mysqld] 中新增以下内容:log-bin=mysql-bin
- 有关pygal的介绍和安装,大家可以参阅《pip和pygal的安装实例教程》,然后利用pygal实现画世界地图。代码如下:#coding=u