protected void btnDeleteChild_Click(object sender, EventArgs e) { int[] intRowindexarray = childGrid.SelectedRowIndexArray; if (intRowindexarray.Length > 0) { systemMenu_button smb = new systemMenu_button(); object[] keys = childGrid.DataKeys[intRowindexarray[0]]; string strID = keys[0].ToString(); string strpid = keys[1].ToString(); Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("ID", " cast(ID as varchar(36))='" + strID + "' "); int intresult = smb.deletebycondition("systemMenu_button", dic); BindchildGrid(strpid); Alert alert = new Alert(); if (intresult > 0) { alert.Icon = Icon.Information; alert.Message = "成功移除数据"; } else { alert.MessageBoxIcon = MessageBoxIcon.Error; alert.Message = "数据移除失败"; } alert.Show(); } }
private void BindchildGrid(string strpid) { systemMenu_button smb = new systemMenu_button(); System.Data.DataTable dt = smb.getBindDataAsdt(strpid); editID.Text = strpid; childGrid.DataSource = dt; childGrid.DataBind(); }
private void initchildinfo(string strID) { systemMenu_button smb = new systemMenu_button(); System.Data.DataTable dt = smb.getEditdata(strID); DataRow r = dt.Rows[0]; editchildID.Text = strID; functionname.Text = r["functionname"].ToString().Trim(); buttonid.Text = r["buttonid"].ToString().Trim(); }
protected void btnSaveChild_Click(object sender, EventArgs e) { string strID = editchildID.Text.ToString().Trim(); string strpid = editID.Text.ToString().Trim(); Dictionary <string, string> dic = initchildDatadic(strpid); systemMenu_button smb = new systemMenu_button(); int intresult = 0; if (strID == "") { dic.Add("ID", Guid.NewGuid().ToString()); intresult = smb.add(dic, "systemMenu_button"); } else { intresult = smb.update(dic, "systemMenu_button", "ID", strID); } BindchildGrid(strpid); Alert alert = new Alert(); if (intresult == 1) { alert.Icon = Icon.Information; alert.Message = "数据保存成功"; } else { alert.MessageBoxIcon = MessageBoxIcon.Error; alert.Message = "数据保存失败"; } alert.Show(); }