Here is my simple class, where i inherit from UserControl
.
public class Test:System.Web.UI.UserControl
{
public void BindGrid()
{
Response.Write(IsPostBack);
}
}
Which i call from the Page_Load event
protected void Page_Load(object sender, EventArgs e)
{
new Test().BindGrid();
}
But i get a null reference exception if i try to call any of UserControl
's inerited properies (ispostback
, request
etc etc)
Any ideas why this is happening?
Edit:
It seems to work if replace the 'ispostback' response.write() inside the OnLoad method of Test
?