There are many ways to do the same. The main problem is, you'll never take the help of
Google. Try any one of the following:
jQuery
$(function() {
$('#<%= button1.ClientID %>').click(function() {
window.location.href = "Webform2.aspx";
});
});
ASP.NET
<asp:button id="button1" runat="server" xmlns:asp="#unknown" />
Or, for a specifically ASP.NETesque way to do it, you can use
Button.PostBackUrl = "Default2.aspx";
HTML
<input type="submit" name="button1" value="Button" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("button1", "", true, "", "webform2.aspx", false, false))" id="button1" />
Sever Side
If you've got other processing to do server-side and you need to redirect afterwards, use
Response.Redirect("Default2.aspx");
or
Server.Transfer("Default2.aspx");
in your click event of button/object.
--Amit