using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing;
using System.IO;


namespace Telerik.Web.Examples.ToolTip.TargetControlsAndAjax
{

    public partial class ProductDetails : System.Web.UI.UserControl
    {

        public string ProductID
        {
            get
            {
                if (ViewState["ProductID"] == null)
                {
                    return "";
                }
                return (string)ViewState["ProductID"];
            }
            set
            {
               
                ViewState["ProductID"] = value;
            
            }
        }


        protected void Page_Load(object sender, EventArgs e)
        {
            this.ProductDataSource.SelectParameters["ProductID"].DefaultValue = this.ProductID;

            this.DataBind();
        }


        protected void ProductsView_DataBound(object sender, EventArgs e)
        {
            System.Web.UI.WebControls.Image image = (System.Web.UI.WebControls.Image)ProductsView.FindControl("image");
            if (image == null) return;
            if (!File.Exists(MapPath(image.ImageUrl)))
            {

                image.ImageUrl = "../../Img/Northwind/Products/noimage.jpg";
            }
        }

    }
}