button click problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • laziers@gmail.com

    button click problem

    Hi,

    I have a code like this:

    protected void Page_Load(objec t sender, EventArgs e)
    {
    // CODE1
    }

    protected void Button_Click(ob ject sender, EventArgs e)
    {
    // CODE2
    }

    I was noticed that when I click the button, CODE1 executea and after
    that CODE2 executes.
    Here is the problem, I dont want to execute CODE1 but only CODE2 [and
    I dont want to use isPostBack].
    Is there anyway to do this? I thik that the best way is getting name
    or id of the clicked button.

    bye



  • Ian Semmel

    #2
    Re: button click problem



    "laziers@gmail. com" <laziers@gmail. comwrote in message
    news:e95d663c-eca9-42d4-b69f-5d840d34b29b@c2 3g2000hsa.googl egroups.com:
    Hi,
    >
    I have a code like this:
    >
    protected void Page_Load(objec t sender, EventArgs e)
    {
    // CODE1
    }
    >
    protected void Button_Click(ob ject sender, EventArgs e)
    {
    // CODE2
    }
    >
    I was noticed that when I click the button, CODE1 executea and after
    that CODE2 executes.
    Here is the problem, I dont want to execute CODE1 but only CODE2 [and
    I dont want to use isPostBack].
    But that's the way it works. In Page_Load, you use IsPostBack to
    determine why you are there - is the page being loaded or did someone
    click the button.
    Is there anyway to do this? I thik that the best way is getting name
    or id of the clicked button.
    >
    bye

    Comment

    • Eliyahu Goldin

      #3
      Re: button click problem

      Peter Bromberg has an article that may help you:

      ASP.NET: Which Control Posted Back?


      --
      Eliyahu Goldin,
      Software Developer
      Microsoft MVP [ASP.NET]




      <laziers@gmail. comwrote in message
      news:e95d663c-eca9-42d4-b69f-5d840d34b29b@c2 3g2000hsa.googl egroups.com...
      Hi,
      >
      I have a code like this:
      >
      protected void Page_Load(objec t sender, EventArgs e)
      {
      // CODE1
      }
      >
      protected void Button_Click(ob ject sender, EventArgs e)
      {
      // CODE2
      }
      >
      I was noticed that when I click the button, CODE1 executea and after
      that CODE2 executes.
      Here is the problem, I dont want to execute CODE1 but only CODE2 [and
      I dont want to use isPostBack].
      Is there anyway to do this? I thik that the best way is getting name
      or id of the clicked button.
      >
      bye
      >
      >
      >

      Comment

      • Ian Semmel

        #4
        Re: button click problem

        Programming for the web requires a paradigm-shift compared to
        programming for windows.

        I suggest you go back to basics to get an overview as to what is
        happening.

        Perhaps if you go to Help and look for 'ASP.NET Page Life Cycle
        Overview' and follow it through, you will get the idea.

        "laziers@gmail. com" <laziers@gmail. comwrote in message
        news:e95d663c-eca9-42d4-b69f-5d840d34b29b@c2 3g2000hsa.googl egroups.com:
        Hi,
        >
        I have a code like this:
        >
        protected void Page_Load(objec t sender, EventArgs e)
        {
        // CODE1
        }
        >
        protected void Button_Click(ob ject sender, EventArgs e)
        {
        // CODE2
        }
        >
        I was noticed that when I click the button, CODE1 executea and after
        that CODE2 executes.
        Here is the problem, I dont want to execute CODE1 but only CODE2 [and
        I dont want to use isPostBack].
        Is there anyway to do this? I thik that the best way is getting name
        or id of the clicked button.
        >
        bye

        Comment

        Working...