zoukankan
html css js c++ java
利用ASP.NET AJAX实现表格更新程序
今天看了一个网站
http://aspadvice.com/blogs/azamsharp/archive/2007/06/28/Edit-GridView-Using-CheckBoxes.aspx
,自己做了一个小程序,表格更新程序,主要功能为使用CheckBoxe允许编辑GridView行,并且能够保存修改的信息
具体程序如下:
<%
@ Page Language
=
"
C#
"
AutoEventWireup
=
"
true
"
CodeFile
=
"
MultipleUpdateDemo.aspx.cs
"
Inherits
=
"
MultipleUpdateDemo
"
%>
<!
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
>
<
html
xmlns
="http://www.w3.org/1999/xhtml"
>
<
head
runat
="server"
>
<
title
>
无标题页
</
title
>
<
script
type
="text/C#"
runat
="server"
>
[System.Web.Services.WebMethod]
public static bool UpdateText(string categoryName, string description, string Id)
{
string conectionString
=
"
Data Source=(local);Initial Catalog=Northwind;User ID=sa;Password=sa
"
;
System.Data.SqlClient.SqlConnection conn
=
new
System.Data.SqlClient.SqlConnection(conectionString);
conn.Open();
System.Data.SqlClient.SqlCommand cmd
=
new
System.Data.SqlClient.SqlCommand(
"
UPDATE Categories SET CategoryName = '
"
+
categoryName
+
"
', Description = '
"
+
description
+
"
' WHERE CategoryID =
"
+
Id, conn);
cmd.ExecuteNonQuery();
conn.Close();
return
true
;
}
</
script
>
<
script
type
="text/javascript"
>
function
disableGridViewTextBoxes()
{
var
gvControl
=
document.getElementById(
"
gvCategories
"
);
var
inputElements
=
gvControl.getElementsByTagName(
"
INPUT
"
);
for
( i
=
0
;i
<
inputElements.length; i
++
)
{
if
(isTextBox(inputElements[i]))
{
inputElements[i].disabled
=
<span style="COLOR: #000000; BACKGROUND-COLOR: %2
查看全文
相关阅读:
解决项目迁移至Kubernetes集群中的代理问题
gorm系列-简单入门
py操作mongodb总结
zabbix添加监控项以及常用的键值
监控服务器cpu、磁盘、模板以及自定义key
Zabbix+Grafana打造高逼格监控系统
基于Docker的Mysql主从复制搭建
rbac权限管理
Django的认证系统
Django 中间件
原文地址:https://www.cnblogs.com/liping13599168/p/811492.html
最新文章
Linux笔记总结
关于链接的一些总结
linux中gdb的使用
性能指标TP99之我解
关于JavaScript打印去掉页眉页脚
Android UI基础之五大布局
到底该不该人比人
2015年终总结
解决The current branch is not configured for pull No value for key branch.master.merge found in confi
Android四大布局及其主要属性
热门文章
Jenkins进阶之自动发送邮件的Default Content设置模板
自动化测试中错误用例再次运行解决办法
WebDriver元素查找方法摘录与总结
gorm系列-删除
gorm系列-更新
gorm系列-查询
gorm系列-创建记录及字段默认值
gorm系列-model
运维项目总结
go语言系列-常量
Copyright © 2011-2022 走看看