How to avoid Page_Load() on button click?

后端 未结 6 1738
鱼传尺愫
鱼传尺愫 2021-01-18 03:01

I have two buttons, preview and Save. With help of preview button user can view the data based on the format and then can save.

But when preview is clicked, one text

6条回答
  •  天涯浪人
    2021-01-18 03:40

    From what I am understanding the preview button is causing a postback and you do not want that, try this on your preview button:

    
    

    similarly this also works:

    YourButton.Attributes.Add("onclick", return false");
    

    Edit:

    it seems the answer to the user's question was simple change in the HTML mark up of the preview button

    CausesValidation="False"
    

提交回复
热议问题