Hi guys, Is there a reason why emp object is becoming null when I
click the submit button??

It works fine when I first load the page, the object gets populated,
but when  btn_confirm_Click() gets executed the emp is null.

Thanks,

Maya.


public partial class _default : System.Web.UI.Page
    {

       Employee emp;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {

                emp = new Employee ().GetEmployee();

            }
        }

        protected void btn_confirm_Click(object sender, EventArgs e)
        {

                emp.FirstName = "something";
                emp.LastName = "something";

          }
    }

Reply via email to