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 />
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 />
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
Add:
Response.Redirect("sua url destino");
In the Click event of the button you created.