4 つの列 (ユーザー ID、説明、パスワード、パスワードの変更 [ボタン]) を持つ 1 つのグリッド ビューがあります。
パスワードの変更をクリックすると、3 つのテキストボックス (ユーザー ID、新しいパスワード、パスワードの確認) と保存ボタンを含むパネルが表示されます。
パスワードを変更した後、パネルは消えますが、グリッドビューのパスワードは以前と同じままです。
パスワード列を更新したい。
以下は私の保存ボタンのクリック
コード です
protected void BindGridView()
{
try
{
DataTable dt = new DataTable();
dt = (DataTable)Session["userinfo"];
gvPassInfo.DataSource = dt;
gvPassInfo.DataBind();
}
catch (Exception ex)
{
//lblMessage.Text = DataObjects.Error_Message();
}
}
protected void btnSave_Click(object sender, EventArgs e)
{
clsUser objuser = new clsUser();
string user = txtUserid.Text;
string NewPassword = txtNewPassword.Text;
string ConfirmPassword = txtConfirmNewPassword.Text;
objuser.UpdateSystemPassword(user, NewPassword);
Response.Write("<script LANGUAGE='JavaScript' >alert('Password Changed Successfully...'); document.location='" +ResolveClientUrl("~\\PasswordInformation_Details.aspx") + "'; </script>");
BindGridView();
panelChangePassword.Visible = false;
}
protected void btnSearch1_Click(object sender, EventArgs e)
{
try
{
using (MySqlConnection conn = new MySqlConnection(clsUser.connStr))
{
conn.Open();
string strQuery = "select DISTINCT user_id,description,sap_system_password from sap_password_info where user_id is not null";
if (txtSid.Text !="")
{
strQuery += " AND sid = '" + txtSid.Text + "'";
}
if (txtClient.Text != "")
{
strQuery += " AND client_no = '" + txtClient.Text + "'";
}
if (txtUser.Text != "")
{
strQuery += " AND user_id = '" + txtUser.Text + "'";
}
MySqlCommand cmd = new MySqlCommand(strQuery, conn);
DataTable dt = new DataTable();
dt.Load(cmd.ExecuteReader(CommandBehavior.CloseConnection));
Session["userinfo"] = dt;
Response.Redirect("~\\PasswordInformation_Details.aspx");
}
}
catch (Exception ex)
{
//lblMessage.Text = DataObjects.Error_Message();
lblMsg.Text = ex.Message.ToString();
}
}
コードは C# で、バックエンドは MySQL DB サーバーです。助けてください。