Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8010421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:43:52+00:00 2026-06-04T18:43:52+00:00

I have one grid view with 4 columns(UserId,Description,Password,Change Password[Button]). When i click on change

  • 0

I have one grid view with 4 columns(UserId,Description,Password,Change Password[Button]).

When i click on change password the panel with 3 textboxes(UserID,New Password,Confirm Password) and save button appears.

After changing password the panel disappears but the password in the gridview remains same as previous.

I want to update the password column.

Following is my Save Button Click
Code

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();
    }

}

The code is in C# and back end is MySQL DB Server.. please help..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T18:43:53+00:00Added an answer on June 4, 2026 at 6:43 pm

    Update the GridView at the end of your update event/save button click event

    Edit

    you are updating the record in the database but you are not fetching new data that’s the reason you are getting old information

    so after following statement fetch the data from database and update the session dataset with new data then your problem will solve…

     objuser.UpdateSystemPassword(user, NewPassword);
     //get the updated data from the database after this statement
     //don't forget to update the session with new data
    

    Write this code in old page

    Dictionary<string,string> infor = new Dictionary<string,string>();
    infor["sid"] = txtSid.Text;
    infor["client_no"] = txtClient.Text;
    ..
    ...
    Session["queryInfo"] = infor;
    

    In New File

    GetDataFromDB()
    {
    Dictionary<string,string> infor = (Dictionary<string,string>)Session["queryInfo"];
    
    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 (infor["sid"] !="")
            {
                strQuery += " AND sid = '" + infor["sid"] + "'";
            }
            //... do like above for remaining if conditions
    
            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)
    {
         throw;
    }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one grid view that contains some template columns. In this, the first
I have an AdvancedDataGrid. One of the columns in the grid displayed with help
Grid View Data Bind i have a database table with 4 columns having data
I have a data grid view in one windows form named GridViewForm. When the
I have one grid view control in my asp.net web application. For example i
I have 4-5 grid panels, one form panel and want to put it into
I have data grid view with columns product name and product image and I
I have a Data Grid View and some of the columns are of type
I have a grid view with three columns and five rows with text item
I have a data table bound to a data grid view, one of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.