zoukankan      html  css  js  c++  java
  • asp中 grideview 更新 无法获取值 解决办法

    string str1 = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[7].Controls[0])).Text.ToString().Trim();
    来获取结果 但是不会成功  总是获取空的数据,
     然后我想应该是在获取数据的时候出了点问题后来将Grideview的一个属性
    EnableViewState=false 设置为假 的时候就成功获取了 

    下面贴一些处理代码希望对有同样问题的有点帮助(虽然貌似画蛇添足)
     
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
           //需要将GridView的属性EnableViewState=false
            string constr = ConfigurationManager.ConnectionStrings["xm_data_DataConnectionString"].ConnectionString;
            SqlConnection cn = new SqlConnection(constr);
            string str1 = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[7].Controls[0])).Text.ToString().Trim();
            string strid = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[12].Controls[0])).Text.ToString().Trim();
            string textcommd = "update kyhlxk set 审核提示='" + str1 + "' where id=" + Convert.ToInt32(strid);
            SqlCommand upcommd = new SqlCommand(textcommd, cn);
            cn.Open();
            upcommd.ExecuteNonQuery();
            cn.Close();
            Label1.Text = textcommd;
            GridView1.EditIndex = -1;//编辑状态取消
            gradeview();//是我重新填充Grideview的函数
        }
  • 相关阅读:
    RPM的使用详细演示安装,删除和查询
    GCC 参数详解
    简述configure、pkgconfig、pkg_config_path三者的关系
    RPM查询篇
    Linux软件安装之RPM的安装技巧
    linux gcc 编译时头文件和库文件搜索路径
    嵌入式开发.C语言面试题
    GCC几个选项学习
    asp.net mvc 自定权限实现
    使用Jquery EasyUi常见问题解决方案
  • 原文地址:https://www.cnblogs.com/jiangyi666/p/5506333.html
Copyright © 2011-2022 走看看