gridview中点击按钮按钮文字发生变化

前台

    
                                      
                                       
                                      
                                     

后台代码

 //待邀约按钮变邀约
    protected void Button1_Click(object sender, EventArgs e)
    {
        Button btn = sender as Button;
        GridViewRow row = btn.Parent.Parent as GridViewRow;
        string a = row.Cells[6].ToString();//获得该按钮所在的单元格  

        SqlConnection sqlcon = new SqlConnection(ConfigurationManager.ConnectionStrings["connection"].ConnectionString);
        sqlcon.Open();
        SqlCommand sqlcom;
        string sqlstr = "update JianLi set JL_zhuangtai='已邀约' where ID='" + Convert.ToInt32(row.Cells[0].Text) + "'";
        sqlcom = new SqlCommand(sqlstr, sqlcon);
        sqlcom.ExecuteNonQuery();
        sqlcon.Close();
        LoadDatas();
      

    }

你可能感兴趣的:(gridview中点击按钮按钮文字发生变化)