public void updatenote(object sender, EventArgs e) { int i = 0; foreach (GridViewRow row in GridView1.Rows) { if ((row.FindControl("CheckBox1") as CheckBox).Checked) { int id = 0; id = Convert.ToInt32(GridView1.DataKeys[row.RowIndex].Value); modelCb.id = id; modelCb = sb.getsuppliers(modelCb); modelCb.note = this.TextBox7.Text; sb.update(modelCb); i++; } } if (i == 0) { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "message", " <script>alert('请选择门店'); </script>"); } else { GridView1.DataSourceID = this.SqlDataSource1.ID; GridView1.DataBind(); Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "message", " <script>alert('成功修改" + i + "个门店'); </script>"); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ViewState["supid"] = Request.QueryString["Cid"]; modelsb.id = Convert.ToInt32(ViewState["supid"].ToString()); modelsb = sb.getsuppliers(modelsb); this.TextBox1.Text = modelsb.supplier; this.TextBox9.Text = modelsb.hospid; this.TextBox2.Text = modelsb.province; this.TextBox3.Text = modelsb.city; this.TextBox7.Text = modelsb.branch; this.TextBox6.Text = modelsb.phone; this.TextBox4.Text = modelsb.address; this.TextBox5.Text = modelsb.note; //this.TextBox8.Text = modelsb.map; this.TextBox10.Text = modelsb.type; this.TextBox11.Text = modelsb.lat; this.TextBox12.Text = modelsb.lng; //string sgm = "http://ditu.google.cn/maps?q=" + Server.UrlEncode(modelsb.branch) + "&hl=zh-CN&ie=UTF8" //+ "&ll=" + modelsb.lat + "," + modelsb.lng + "&hq=" + Server.UrlEncode(modelsb.address) + "&z=15"; string sgm = "baidumap.aspx?lng=" + modelsb.lng + "&lat=" + modelsb.lat + ""; this.HyperLink1.NavigateUrl = sgm; this.TextBox8.Text = sgm; //Button3_Click(sender, e); } }