I added a new web form in asp.net application which named Home.
In Home.aspx.cs
I used these following codes :
public partial class Home : System.Web.UI.Page
{
protected string str = "Hello and welcome to c#";
protected void Page_Load(object sender, EventArgs e)
{
}
}
Then I go to Home.aspx
but unfortunately It won't find str
variable.
These are the codes in Home.aspx
:
<body>
<form id="form1" runat="server">
<div>
<%=str %>
</div>
</form>