Click Behavior Different from ASP Button and Coolite Button

  1. #1

    Click Behavior Different from ASP Button and Coolite Button

    Hello everyone,

    I have been trying to add a click event to a Coolite button, and I have noticed that the behavior of the button is different from the behavior of an ASP button with the same click event.

    ASP Button Implementation:

    button1.Click += new EventHandler(btnClick_Click);
    With this, the server side code executes normally. It updates the viewstate, and it then executes the ShowGeneralStep as expected.

            public void btnClick_Click(object sender, EventArgs e)
            {
                activeViewIndex = 0;
                ViewState.Add("ACTIVEVIEWINDEX", activeViewIndex);
                ShowGeneralStep();
            }
    If I use a Coolite button through, and I add the event using either AjaxEvents or Listeners, it does not execute the code as expected. It runs through the btnClick_Click method, but when the page reloads, the activeViewIndex and ViewState have not been changed. I also tried this with a Coolite button..

    
    button1.Click += new EventHandler(btnClick_Click);
    And it didn't do anything. It didn't even try to call btnClick_Click.

    I tried setting ViewStateMode = ViewStateMode.Include, and it hasn't made a difference. Does anyone know what I am doing wrong? I would like to use Coolite buttons instead of ASP buttons.

    Thanks!


  2. #2

    RE: Click Behavior Different from ASP Button and Coolite Button

    Hi,

    By default the Coolite button doesn't perform postback therefore Click handler is not executed. Ypu have to set AutoPostBack="true"

    If you use click AjaxEvent the ViewState is not sent back to the client by default. You have to set ViewStateMode="Include" for AjaxEvent to update ViewState on the client side

    Please create simple example which demonstrates the problem
  3. #3

    RE: Click Behavior Different from ASP Button and Coolite Button

    Thank you so much!! All I needed was to add AutoPostBack = true to solve the problem.

Similar Threads

  1. [CLOSED] When button click, open the menu of button
    By supera in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Feb 22, 2012, 4:23 PM
  2. Replies: 1
    Last Post: May 25, 2011, 5:06 PM
  3. Replies: 4
    Last Post: Nov 19, 2010, 1:39 PM
  4. [CLOSED] [1.0] Change in radio button behavior - inputvalue
    By betamax in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Oct 18, 2010, 4:02 PM
  5. Replies: 3
    Last Post: Feb 02, 2010, 6:32 PM

Posting Permissions