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 7040121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:52:49+00:00 2026-05-28T01:52:49+00:00

I have used same command button Click event for both Insert, Update functionalities. I’m

  • 0

I have used same command button Click event for both Insert, Update functionalities.

I’m checking with the url-querystring to achieve this functioality.
If the url-querystring is null then the page is meant for insert.
If the url-querystring is NOT null then the page is meant for update.

The code is shown below, but the update functionality is not working. When I debug the page, I understood that the new updated value is not presenting in the debug window. I have modified CR_TITLE and debugged. The new value is not coming in the debug. What is the problem?

    protected void btnInsert_Click(object sender, EventArgs e)
    {
        try
        {
            ChangeRequest changeRequest = new ChangeRequest();
            changeRequest.CR_REF_NO = txtCRRefNumber.Text.Trim();
            changeRequest.CR_TITLE = txtCRTitle.Text.Trim();
            changeRequest.ORIGIN1_ID = Convert.ToInt32(ddlOrigin1.SelectedValue);
            if (Request["ecr"] == null)
            {
                (new ChangeRequestBLL()).InsertECR(changeRequest);

                ((BLMSite)this.Master).ErrorText = string.Empty;
                ((BLMSite)this.Master).MessageText = "Record inserted successfully";
            }
            else if (Request["ecr"] != null)
            {
                (new ChangeRequestBLL()).UpdateECR(ecrRefNo, changeRequest);

                ((BLMSite)this.Master).ErrorText = string.Empty;
                ((BLMSite)this.Master).MessageText = "Record updated successfully";
            }
        }
        catch (Exception ex)
        {
            ((BLMSite)this.Master).ErrorText = ex.Message;
            ((BLMSite)this.Master).MessageText = string.Empty;
        }
    }

Edit: I need to put this code inside (!Page.IsPostBack) condition. This is where I have committed mistake. Adding of this statement solved my problem.

  • 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-05-28T01:52:50+00:00Added an answer on May 28, 2026 at 1:52 am

    It is just logic problem.

    I handled the code just by setting iside !Page.IsPostBack condition and the problem is got solved. Hence, logic cannot be shown.

    Thanks.

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

Sidebar

Related Questions

I have two SQL Server (2000) databases. Both are used for the same project,
I have heard both of these terms used, are they the same thing or
I dont get it. I have used a similar/same approach for many years now,
If two users edit the same wiki topic, what methods have been used in
I will have multiple tables used by different projects on the same mySql server.
I have a component done in JSF 1.x, this component has a command button
I have successfully used the following command line to create a new GIF image
I have used SUBST command to create mapped drive to a certain folder. In
I have used traditional version control systems to maintain source code repositories on past
I have used IPC in Win32 code a while ago - critical sections, events,

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.