How to make (link)button function as hyperlink?

前端 未结 5 1556
清酒与你
清酒与你 2021-01-17 08:49

How do I use an asp:Button or asp:LinkButton as asp:Hyperlink?

The existing Hyperlink just goes to another section on the same

5条回答
  •  余生分开走
    2021-01-17 09:30

    You can use OnClientClick event to call a JavaScript function:

    
    

    JavaScript code:

    function redirect() {
      location.href = 'page.aspx';
    }
    

    But i think the best would be to style a hyperlink with css.

    Example :

    .button {
      display: block;
      height: 25px;
      background: #f1f1f1;
      padding: 10px;
      text-align: center;
      border-radius: 5px;
      border: 1px solid #e1e1e2;
      color: #000;
      font-weight: bold;
    }
    

提交回复
热议问题