Using an Aspx page as a partial razor view
In my Asp.Net MVC3 project, I have an aspx page called Partial Razor View. On the Aspx page, I have a button that should fire an event implemented in the script part. Here is the code:
<%@ Page Language="C#" AutoEventWireup="true" %>
<head>
<script runat="server" language="CS">
public void Page_Load(object sender, EventArgs e)
{
//
//Instructions
//
}
}
public void Button2_Click(object sender, EventArgs e)
{
//
//Instructions
//
}
</script>
</head>
<form id="frep" runat="server">
<asp:Button ID="Button2" runat="server" Text="Button" ></asp:Button>
</form>
Now, my problem is that the button event does not fire when I click the button (opposite when the Page_Load event fires when I refresh the page). I have tried several solutions but I am not resolving this.
+3
source to share