.net - Do Response.Redirect in aspx markup -


i have .net button should response.redirect. can in markup?

<asp:button runat="server" onclick='<%# response.redirect("~/administration.aspx"); %>' text="cancel"></asp:button> 

it not work because "cannot implicitly convert void object"

you can't assign code directly that. need assign method handles event, like:

onclick="btn1_click"  protected void btn1_click(object sender, eventargs e) {     response.redirect("~/administration.aspx"); } 

edit

what can skip asp.net altogether , regular html , javascript, avoid post:

<input type="button" onclick="window.location.href = '<%= resolveurl("~/administration.aspx") %>'"> 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -