断点看下GridView1.Rows[e.RowIndex].Cells[0].Controls[0].ToString()什么内容
解决方案 »
- 救命,如何在gridview中的某列显示百分比进度条,百分比值已经获取?!
- .net里怎样写javascript验证代码?
- 有人用.net flexcell 做报表吗 ?给个例子
- World Wide Web Publishing服务无法启动(iis不能用)
- 关于JScript 的字符串处理问题
- 在IE中打开EXCEL之后另存文件,出现身份验证对话框,怎么办???
- 一个C#页面生成时出现的奇怪错误,不解中...
- ASP.NET2.0 中TreeView要如何设置才能(象ASP.NET1.0中的AutoPostBack=false)
- 同一页面显示数据和添加数据的问题
- checkbox取消勾选提交后台没有获取到数据
- 请教sql 语句的一个经典问题,
- 不能跳转页面问题(在线望兄台帮忙)
SqlConnection myConnection = new SqlConnection(strConnection); SqlCommand cm = new SqlCommand("updateu", myConnection);
cm.CommandType = CommandType.StoredProcedure;
cm.Connection.Open();
Guid userID;
string userLogName,username, sex, phone, mobilephone; userID = new Guid(GridView1.Rows[e.RowIndex].
Cells[0].Controls[0].ToString());
userLogName = ((TextBox)GridView1.Rows[e.RowIndex].
Cells[1].Controls[0]).Text;
username = ((TextBox)GridView1.Rows[e.RowIndex].
Cells[3].Controls[0]).Text;
sex = ((TextBox)GridView1.Rows[e.RowIndex].
Cells[4].Controls[0]).Text;
phone = ((TextBox)GridView1.Rows[e.RowIndex].
Cells[5].Controls[0]).Text;
mobilephone = ((TextBox)GridView1.Rows[e.RowIndex].
Cells[5].Controls[0]).Text; cm.Parameters.Add(new SqlParameter("@userid", userID));
cm.Parameters.Add(new SqlParameter("@userLogName", userLogName));
cm.Parameters.Add(new SqlParameter("@username ", username));
cm.Parameters.Add(new SqlParameter("@sex",sex));
cm.Parameters.Add(new SqlParameter("@phone", phone));
cm.Parameters.Add(new SqlParameter("@mobilephone", mobilephone));
cm.ExecuteNonQuery(); GridView1.EditIndex = -1;
Bindgridview();
目前的情况明显是GridView1.Rows[e.RowIndex].Cells[0].Controls[0].ToString()格式不对吗,你看看这里到底显示的是什么
string userID= System.Guid.NewGuid().ToString().Trim();
{
String strConnection = System.Configuration.ConfigurationManager.AppSettings["ConnectionString"]; //String strConnection = ConfigurationSettings.AppSettings["connstring"]; SqlConnection myConnection = new SqlConnection(strConnection);
//SqlDataAdapter da = new SqlDataAdapter("select * from users order by sysdate desc", myConnection); SqlDataAdapter da = new SqlDataAdapter("select * from users", myConnection);
DataSet ds = new DataSet();
da.Fill(ds, "users");
DataView dv = ds.Tables[0].DefaultView;
if (ViewState["sortexpression"] != null)
{
dv.Sort = ViewState["sortexpression"].ToString() + " " + ViewState["sortdirection"].ToString();
} GridView1.DataSource = dv;
GridView1.DataBind();
}