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
  • 相关阅读:
    HDU 2896 病毒侵袭 (AC自动机)
    HDU 2222 Keywords Search (AC自动机)
    HDU 2457 DNA repair (AC自动机+DP)
    CoFun 1612 单词分组(容斥)
    邓_mysql_面试
    Html5+js测试题(开发版)
    Html5+js测试题【完整版】
    HTML面试
    支付宝+微信=合成二维码
    邓_laravel框架——news
  • 原文地址:https://www.cnblogs.com/liping13599168/p/811492.html
Copyright © 2011-2022 走看看