当前位置:编程学习 > C#/ASP.NET >>

更新绑定了DropDownList的GridView

string qf_bclassname = ((TextBox)(GridView_ClassM.Rows[e.RowIndex].Cells[1].Controls[0])).Text.ToString().Trim();
                      OleDbConnection con = db.con();
          
            if (qf_bclassname.Length == 0)
            {
                Response.Write("<script>alert('分类名称不能为空!');</script>"); 
                return;
            }
            else
            {
                                
                string sql = "update sw_bclass set qf_bclassname='"
                    +((TextBox)(GridView_ClassM.Rows[e.RowIndex].Cells[1].Controls[0])).Text.ToString().Trim()+"',qf_aclassid='"+((DropDownList)GridView_ClassM.Rows[e.RowIndex].FindControl("DropDownList_BigClass")).SelectedValue.Trim()+"' where qf_bclassid='"+GridView_ClassM.DataKeys[e.RowIndex].Value.ToString()+"'";
                OleDbCommand cmd = new OleDbCommand(sql, con);
                con.Open();
                cmd.ExecuteNonQuery();
                con.Close();
                GridView_ClassM.EditIndex = -1;
                GridView_ClassMDataBind(-1);
            }
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,