Redirect ASP NET

Asked

Viewed 1,070 times

0

How can I redirect the page I find myself through an html inputButton on ASP NET WEB FORMS

the code of my button:

 <input id="ButtonD" style="width: 169px" type="button" value="D"  /><br />
  • pq tu não utiliza um <a /> ? ou um Asp:button, que tem o evento onClick. In the onClick event you would execute the code: Response.Redirect("url");

2 answers

0


You can assign a function

Assigning to Onclientclick Event to call a Javascript function on a asp:Button:

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

Or in the 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

0

Add:

Response.Redirect("sua url destino");

In the Click button you created.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.