protected void ProductCat_SelectedIndexChanged(object sender, EventArgs e)
        {
            #region Populating SubCategory Dropdown
            try
            {
                connection.Open();
                SqlCommand     command = new SqlCommand("Select * From tblSub_Category WHERE CategoryID ='" + ProductCat.SelectedValue.ToString() + "'", connection);
                DataSet        ds      = new DataSet();
                SqlDataAdapter sA      = new SqlDataAdapter(command);
                sA.Fill(ds);
                ProductSubCat.DataSource     = ds.Tables[0];
                ProductSubCat.DataTextField  = "Name";
                ProductSubCat.DataValueField = "Sub_CatID";
                ProductSubCat.DataBind();

                if (ProductSubCat != null)
                {
                    ProductSubCat.Items.Insert(0, "Select Sub Category");
                    ProductSubCat.SelectedIndex = 0;
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                connection.Close();
            }
            #endregion
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                #region Populating Product Type DropDown
                ProductType.Items.Add("Select Product Type");
                ProductType.Items.Add("Medicine(HAAD)");
                ProductType.Items.Add("Medicine(Non HAAD)");
                ProductType.Items.Add("Non Medicine");
                #endregion

                #region Populating Product Department DropDown
                try
                {
                    connection.Open();
                    SqlCommand     command = new SqlCommand("Select * From tblDepartment", connection);
                    DataSet        ds      = new DataSet();
                    SqlDataAdapter sA      = new SqlDataAdapter(command);
                    sA.Fill(ds);
                    ProductDept.DataSource     = ds.Tables[0];
                    ProductDept.DataTextField  = "Name";
                    ProductDept.DataValueField = "DepId";
                    ProductDept.DataBind();
                    if (ProductDept != null)
                    {
                        ProductDept.Items.Insert(0, "Select Department");
                        ProductDept.SelectedIndex = 0;
                    }
                }
                catch (Exception ex)
                {
                }
                finally
                {
                    connection.Close();
                }
                #endregion

                #region Populating Category Dropdown
                try
                {
                    connection.Open();
                    SqlCommand     command = new SqlCommand("Select * From tblCategory", connection);
                    DataSet        ds      = new DataSet();
                    SqlDataAdapter sA      = new SqlDataAdapter(command);
                    sA.Fill(ds);
                    ProductCat.DataSource     = ds.Tables[0];
                    ProductCat.DataTextField  = "Name";
                    ProductCat.DataValueField = "CategoryID";
                    ProductCat.DataBind();
                    if (ProductCat != null)
                    {
                        ProductCat.Items.Insert(0, "Select Category");
                        ProductCat.SelectedIndex = 0;
                    }
                }
                catch (Exception ex)
                {
                }
                finally
                {
                    connection.Close();
                }
                #endregion

                #region Populating SubCategory Dropdown
                try
                {
                    connection.Open();
                    SqlCommand     command = new SqlCommand("Select * From tblSub_Category", connection);
                    DataSet        ds      = new DataSet();
                    SqlDataAdapter sA      = new SqlDataAdapter(command);
                    sA.Fill(ds);
                    ProductSubCat.DataSource     = ds.Tables[0];
                    ProductSubCat.DataTextField  = "Name";
                    ProductSubCat.DataValueField = "Sub_CatID";
                    ProductSubCat.DataBind();

                    if (ProductSubCat != null)
                    {
                        ProductSubCat.Items.Insert(0, "Select Sub Category");
                        ProductSubCat.SelectedIndex = 0;
                    }
                }
                catch (Exception ex)
                {
                }
                finally
                {
                    connection.Close();
                }
                #endregion

                #region ProductOrderType dropdown population
                ddlProductOrderType.DataSource     = IMSGlobal.GetOrdersType();
                ddlProductOrderType.DataTextField  = "Name";
                ddlProductOrderType.DataValueField = "OrderTypeId";
                ddlProductOrderType.DataBind();

                if (ddlProductOrderType != null)
                {
                    ddlProductOrderType.Items.Insert(0, "Select Product Order Type");
                    ddlProductOrderType.SelectedIndex = 0;
                }
                #endregion

                BindGridbyFilters();
            }
        }