protected void Grid1_RowCommand(object sender, FineUI.GridCommandEventArgs e) { string exception = ""; if (e.CommandName == "Reset") { object[] keys = Grid1.DataKeys[e.RowIndex]; string id = (string)keys[0]; if (FirstManagementCtrl.ResetPassword(id, ref exception)) { Alert.ShowInTop("重置密码成功!新密码为000000", MessageBoxIcon.Information); } else { Alert.ShowInTop("重置失败!\n原因:" + exception, MessageBoxIcon.Error); } bindFirstToGrid(); } }
private void bindFirstToGrid() { string exception = ""; List <string> IDs = new List <string>(); DataTable table = new DataTable(); if (FirstManagementCtrl.GetAll(ref IDs, ref exception)) { table.Columns.Add("ID"); foreach (string id in IDs) { table.Rows.Add(id); } Grid1.DataSource = table; Grid1.DataBind(); } else { table.Clear(); Grid1.DataSource = table; Grid1.DataBind(); } }