Redirect ASP NET

0

How can I redirect the page I encounter via an html inputButton in ASP NET WEB FORMS

the code of my button :

 <input id="ButtonD" style="width: 169px" type="button" value="D"  /><br />
    
asked by anonymous 03.04.2014 / 14:27

2 answers

0

You can assign a function

Assigning the OnClientClick event to call a JavaScript function on a asp:Button :

<asp:Button ID="ButtonD" runat="server" Text="Button" onclientclick='redirect()' />

Or no input type="button" :

<input id="ButtonD" style="width: 169px" onclick="redirect()" type="button" value="D"  /><br />

JavaScript:

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

You can also link by ID

jQuery (if it is input type="button" ):

$("#ButtonD").click(function(){
   location.href = 'page.aspx';
});

jQuery (if it is asp:Button ):

$("#<%= TextBox1.ClientID %>").click(function(){
  location.href = 'page.aspx';
});

Reference: link SOEN

    
03.04.2014 / 14:40
0

Add:

Response.Redirect("sua url destino");

In the Click event of the button you created.

    
03.04.2014 / 16:17