using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class WebUserControl : System.Web.UI.UserControl
{
    private object _dataItem = null;
    public object DataItem
    {
        get
        {
            return this._dataItem;
        }
        set
        {
            this._dataItem = value;
            if (value != null)
                ViewState["MyID"] = DataBinder.Eval(this._dataItem,"CustomerID").ToString();            
        }
    }
    
    override protected void OnInit(EventArgs e)
    {       
        InitializeComponent();
        base.OnInit(e);
    }

    
    private void InitializeComponent()
    {
        this.DataBinding += new System.EventHandler(this.EmployeeDetails_DataBinding);

    }

    protected void EmployeeDetails_DataBinding(object sender, System.EventArgs e)
    {
        SqlDataSource2.SelectParameters["CustomerID"].DefaultValue = ViewState["MyID"].ToString(); 
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        
    }
    
}
