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

  • Home
  • SEARCH
  • 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 8162407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:42:02+00:00 2026-06-06T18:42:02+00:00

The following code is from a details page that receives a querystring from another

  • 0

The following code is from a details page that receives a querystring from another page and then loads the details based on that id passed. That works fine, but now my problem is that the save changes button does not seem to be doing what it should be; the page just flashes like it submitted and loads all the values back, I’ve debugged and it all goes through fine, what could be the issue? Could it have something to do with me using querystring, because I have another update command on another page (no querystring) and it works perfectly…

    namespace CC
{
    public partial class customerdetails : System.Web.UI.Page
    {
        int customerID = 0;

        protected void Page_Load(object sender, EventArgs e)
        {
            customerID = Convert.ToInt32(Request.QueryString["id"]);
            string strConnString2 = "Data Source=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
            using (SqlConnection con = new SqlConnection(strConnString2))
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection = con;
                    cmd.CommandType = CommandType.Text;
                    cmd.CommandText = "SELECT CustomerStatus, CustomerGroup, CustomerFirstName, CustomerLastName, CompanyName, CustomerAddress, CustomerCity, CustomerState, CustomerZipcode, CustomerEmail, CustomerEmail2, CustomerPhoneNumber, CustomerPhoneNumberExt, CustomerType, CustomerSubscriptionType, CustomerCost, CustomerPaymentMethod, CustomerSignUpDate, CustomerPickUpDay, CustomerPickUpDay2, CustomerNotes FROM Customers WHERE CustomerID = @CustomerID";
                    cmd.Parameters.AddWithValue("@CustomerID", customerID);
                    con.Open();
                    using (var reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            if (reader["CustomerStatus"].ToString() == "New")
                            {
                                StatusLabel.ForeColor = System.Drawing.Color.YellowGreen;
                            }
                            else
                            {
                                if (reader["CustomerStatus"].ToString() == "Suspended")
                                {
                                    StatusLabel.ForeColor = System.Drawing.Color.Aqua;
                                }
                                else
                                {
                                    StatusLabel.ForeColor = System.Drawing.Color.DarkRed;
                                }
                            }
                            StatusLabel.Text = reader["CustomerStatus"].ToString();
                            if (reader["CustomerGroup"].ToString() == "")
                            {
                            }
                            else
                            {
                                GroupDropDown.SelectedValue = reader["CustomerGroup"].ToString();
                            }
                            txtCustomerFirstName.Text = reader["CustomerFirstName"].ToString();
                            txtCustomerLastName.Text = reader["CustomerLastName"].ToString();
                            txtCompanyName.Text = reader["CompanyName"].ToString();
                            txtCustomerAddress.Text = reader["CustomerAddress"].ToString();
                            txtCustomerCity.Text = reader["CustomerCity"].ToString();
                            txtCustomerState.Text = reader["CustomerState"].ToString();
                            txtCustomerZipcode.Text = reader["CustomerZipcode"].ToString();
                            txtCustomerEmail.Text = reader["CustomerEmail"].ToString();
                            if (reader["CustomerEmail2"].ToString() == "")
                            {

                            }
                            else
                            {
                                Email2CheckBox.Checked = true;
                                txtCustomerEmail2.Visible = true;
                                txtCustomerEmail2.Text = reader["CustomerEmail2"].ToString();
                            }
                            txtCustomerPhoneNumber.Text = reader["CustomerPhoneNumber"].ToString();
                            txtCustomerPhoneNumberExt.Text = reader["CustomerPhoneNumberExt"].ToString();
                            CustomerType.SelectedValue = reader["CustomerType"].ToString();
                            SubscriptionType.SelectedValue = reader["CustomerSubscriptionType"].ToString();
                            CostTxtBx.Text = reader["CustomerCost"].ToString();
                            CustomerPaymentMethod.SelectedValue = reader["CustomerPaymentMethod"].ToString();
                            CustomerSignUpDate.Text = reader["CustomerSignUpDate"].ToString();
                            PickUpDay.SelectedValue = reader["CustomerPickUpDay"].ToString();
                            if (reader["CustomerPickUpDay2"].ToString() == "")
                            {

                            }
                            else
                            {
                                PickUpDay2CheckBox.Checked = true;
                                PickUpDay2.Visible = true;
                                PickUpDay2.SelectedValue = reader["CustomerPickUpDay2"].ToString();
                            }
                            if (reader["CustomerNotes"].ToString() == "")
                            {
                            }
                            else
                            {
                                string sqlfriendlyNotes = reader["CustomerNotes"].ToString().Replace("<br/>", "\n");

                                NotesTxtBx.Text = sqlfriendlyNotes;
                            }

                        }
                    }
                    con.Close();
                }
            }
        }

        protected void SaveCustomerChanges_Click(object sender, EventArgs e)
        {
            string Status = this.StatusLabel.Text;
            string Group = this.GroupDropDown.Text;
            string customerStatus = Status;
            string customerFirstName = this.txtCustomerFirstName.Text;
            string customerLastName = this.txtCustomerLastName.Text;
            string customerGroup = Group;
            string companyName = this.txtCompanyName.Text;
            string customerAddress = this.txtCustomerAddress.Text;
            string customerCity = this.txtCustomerCity.Text;
            string customerState = this.txtCustomerState.Text;
            string customerZipcode = this.txtCustomerZipcode.Text;
            string customerEmail = this.txtCustomerEmail.Text;
            string customerEmail2 = this.txtCustomerEmail2.Text;
            string customerPhoneNumber = this.txtCustomerPhoneNumber.Text;
            string customerPhoneNumberExt = this.txtCustomerPhoneNumberExt.Text;
            string customerType = this.CustomerType.Text;
            string customerSubscriptionType = this.SubscriptionType.Text;
            string customerCost = this.CostTxtBx.Text;
            string customerPaymentMethod = this.CustomerPaymentMethod.Text;
            string customerSignUpDate = this.CustomerSignUpDate.Text;
            string customerPickUpDay = this.PickUpDay.Text;
            string customerPickUpDay2 = this.PickUpDay2.Text;
            string customerNotes = this.NotesTxtBx.Text.Replace("\n", "<br/>");
            string strConnString1 = "Data Source=xxxxxxxxxxxxxx";
            using (SqlConnection con = new SqlConnection(strConnString1))
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection = con;
                    cmd.CommandType = CommandType.Text;
                    cmd.CommandText = "UPDATE Customers SET CustomerStatus=@CustomerStatus, CustomerGroup=@CustomerGroup, CustomerFirstName=@CustomerFirstName, CustomerLastName=@CustomerLastName, CompanyName=@CompanyName, CustomerAddress=@CustomerAddress, CustomerCity=@CustomerCity, CustomerState=@CustomerState, CustomerZipcode=@CustomerZipcode, CustomerEmail=@CustomerEmail, CustomerEmail2=@CustomerEmail2, CustomerPhoneNumber=@CustomerPhoneNumber, CustomerPhoneNumberExt=@CustomerPhoneNumberExt, CustomerType=@CustomerType, CustomerSubscriptionType=@CustomerSubscriptionType, CustomerCost=@CustomerCost, CustomerPaymentMethod=@CustomerPaymentMethod, CustomerSignUpDate=@CustomerSignUpDate, CustomerPickUpDay=@CustomerPickUpDay, CustomerPickUpDay2=@CustomerPickUpDay2, CustomerNotes=@CustomerNotes WHERE CustomerID = @CustomerID";
                    cmd.Parameters.AddWithValue("@CustomerID", customerID);
                    cmd.Parameters.AddWithValue("@CustomerStatus", customerStatus);
                    cmd.Parameters.AddWithValue("@CustomerGroup", customerGroup);
                    cmd.Parameters.AddWithValue("@CustomerFirstName", customerFirstName);
                    cmd.Parameters.AddWithValue("@CustomerLastName", customerLastName);
                    cmd.Parameters.AddWithValue("@CompanyName", companyName);
                    cmd.Parameters.AddWithValue("@CustomerAddress", customerAddress);
                    cmd.Parameters.AddWithValue("@CustomerCity", customerCity);
                    cmd.Parameters.AddWithValue("@CustomerState", customerState);
                    cmd.Parameters.AddWithValue("@CustomerZipcode", customerZipcode);
                    cmd.Parameters.AddWithValue("@CustomerEmail", customerEmail);
                    cmd.Parameters.AddWithValue("@CustomerEmail2", customerEmail2);
                    cmd.Parameters.AddWithValue("@CustomerPhoneNumber", customerPhoneNumber);
                    cmd.Parameters.AddWithValue("@CustomerPhoneNumberExt", customerPhoneNumberExt);
                    cmd.Parameters.AddWithValue("@CustomerType", customerType);
                    cmd.Parameters.AddWithValue("@CustomerSubscriptionType", customerSubscriptionType);
                    cmd.Parameters.AddWithValue("@CustomerCost", customerCost);
                    cmd.Parameters.AddWithValue("@CustomerPaymentMethod", customerPaymentMethod);
                    cmd.Parameters.AddWithValue("@CustomerSignUpDate", customerSignUpDate);
                    cmd.Parameters.AddWithValue("@CustomerPickUpDay", customerPickUpDay);
                    cmd.Parameters.AddWithValue("@CustomerPickUpDay2", customerPickUpDay2);
                    cmd.Parameters.AddWithValue("@CustomerNotes", customerNotes);
                    con.Open();
                    cmd.ExecuteNonQuery();
                    con.Close();
                }
            }
        }
  • 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-06T18:42:03+00:00Added an answer on June 6, 2026 at 6:42 pm

    Your button click event handler SaveCustomerChanges_Click will occur after your Page_Load event handler. Your page load event handler is loading up your UI. You are updating the data after your UI has already loaded. You need to reload the UI after the update is performed ( think “DataBind” ).

    See the following msdn article for an overview on the ASP.NET Page Life Cycle:
    http://msdn.microsoft.com/en-us/library/ms178472.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I found the following code from this page JQuery UI DatePicker using 2
I've got the following code from another question on SO to track the changing
I took the following code from the examples page on Asio class tcp_connection :
I have the following code $result = $handle->select()->from('store_details') ->where('store_details.store_id=?', $id) ->columns('store_details.store_name'); //->query(ZEND_DB::FETCH_OBJ); However, when
the following code (from a database object created for each new view): -(void)update:(NSString *)queryText{
I have the following code: from random import randint,choice add=lambda x:lambda y:x+y sub=lambda x:lambda
I run the following code from command line: public class MemoryTest { public static
I've borrowed the following code from Wei-Meng Lee's "Beginning Android Application Development": import android.content.Context;
I have the following code: from selenium import selenium selenium = selenium(localhost, 4444, *chrome,
Let's say I have a web page ( /index.html ) that contains the following

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.