I have a problem with user control. I cannot call method from usercontrol. My default.aspx are contains Update panel. Because I don't want repostback page.
My default.aspx page is:
public partial class Page_Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Load();
}
private void Load()
{
if (Session["User"] == null)
{
ApplicationController.Controls.Add(new UserControl().LoadControl("View/Public/Login.ascx"));
}
else
{
ApplicationController.Controls.Add(new UserControl().LoadControl("View/Public/Welcome.ascx"));
}
}
}
and Dynamically Added UserControls is:
public partial class View_Public_Login : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnAssetsGiris_Click(object sender, EventArgs e)
{
var user = new Kys.Dbo.Assets.user()
{
UserId = txtEmail.Text.Trim(),
Pwd = txtPwd.Text.Trim()
}.Login();
if (user != null)
{
Session["User"] = user;
}
}
}
How to call Load()
method from user control?