using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class product_details1 : System.Web.UI.Page
{
    Products local_product = new Products();
    protected void Page_Load(object sender, EventArgs e)
    {
        string productid = Request.QueryString["proid"];
        string categoryid = Request.QueryString["category"];

        if (productid != null && categoryid == "6")
        {
            BindProductDetails(categoryid, productid);
        }
        else
        {
            Response.Redirect("Default.aspx");
        }
    }

    private void BindProductDetails(string categoryid, string productid)
    {
        DataTable dt = new DataTable();
        try
        {
            dt = local_product.getProdtuctsByCatidndproid(categoryid, productid);
            if (dt.Rows.Count > 0)
            {
                rpProductDetails.DataSource = dt;
                rpProductDetails.DataBind();
            }
            else
            {
                lblMessage.Text = "<br/><br/><br/>There is no product found.";
                lblMessage.Font.Size = 20;
            }
        }

        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }
    }
}