protected void GrdProductDetail_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Delete")
        {

            dsProductMainPageSectionTableAdapters.ProductMainPageSectionTableAdapter taProductMainPageSection = new dsProductMainPageSectionTableAdapters.ProductMainPageSectionTableAdapter();

            int CompanyId; int SubCategoryId; int CategoryId; int ProductGroupCode;

            #region SetListVariables
            CompanyId = StringOperation.QueryStringInt16Value(Request.QueryString["CompanyId"]);
            CategoryId = StringOperation.QueryStringInt16Value(Request.QueryString["CategoryId"]);
            SubCategoryId = StringOperation.QueryStringInt16Value(Request.QueryString["SubCategoryId"]);
            ProductGroupCode = StringOperation.QueryStringInt16Value(Request.QueryString["ProductGroupCode"]);
            #endregion

            string[] arg = new string[2];
            arg = e.CommandArgument.ToString().Split(';');
            int ProductId = Convert.ToInt32(arg[0]);
            int SectionCode = Convert.ToInt32(arg[1]);
            taProductMainPageSection.Prc_Ins_ProductMainPageSection(CompanyId, CategoryId, SubCategoryId, ProductGroupCode, SectionCode, ProductId);
            Response.Redirect("MainPageSectionDetail.aspx?CompanyId=" + CompanyId + "&CategoryId=" + CategoryId + "&SubCategoryId=" + SubCategoryId + "&ProductGroupCode=" + ProductGroupCode);

        }
    }
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "AddRemove")
        {

            dsProductMainPageSectionTableAdapters.ProductMainPageSectionTableAdapter taProductMainPageSection = new dsProductMainPageSectionTableAdapters.ProductMainPageSectionTableAdapter();

        int CompanyId_; int SubCategoryId_; int CategoryId_; int ProductGroupCode_;

        #region SetListVariables

        CompanyId_ = StringOperation.QueryStringInt16Value(Request.QueryString["CompanyId_"]);
        CategoryId_ = StringOperation.QueryStringInt16Value(Request.QueryString["CategoryId_"]);
        SubCategoryId_ = StringOperation.QueryStringInt16Value(Request.QueryString["SubCategoryId_"]);
        ProductGroupCode_ = StringOperation.QueryStringInt16Value(Request.QueryString["ProductGroupCode_"]);
        SectionCode = StringOperation.QueryStringInt16Value(Request.QueryString["SectionCode"]);
        #endregion

        int ProductId = Convert.ToInt32(e.CommandArgument);
        taProductMainPageSection.Prc_Ins_ProductMainPageSection(CompanyId_, CategoryId_, SubCategoryId_, ProductGroupCode_, SectionCode, ProductId);

        Response.Redirect("MainPageSectionDetail.aspx?CompanyId=" + CompanyId_ + "&CategoryId=" + CategoryId_ + "&SubCategoryId=" + SubCategoryId_ + "&ProductGroupCode=" + ProductGroupCode_);

        }
    }
    private void SetExpiry(Boolean ToSet , Boolean ToRemove)
    {
        DateTime ExpiryDate;

        dsProductMainPageSectionTableAdapters.ProductMainPageSectionTableAdapter taProductMainPageSection = new dsProductMainPageSectionTableAdapters.ProductMainPageSectionTableAdapter();

        int CompanyId; int SubCategoryId; int CategoryId; int ProductGroupCode;

        #region SetListVariables
        CompanyId = StringOperation.QueryStringInt16Value(Request.QueryString["CompanyId"]);
        CategoryId = StringOperation.QueryStringInt16Value(Request.QueryString["CategoryId"]);
        SubCategoryId = StringOperation.QueryStringInt16Value(Request.QueryString["SubCategoryId"]);
        ProductGroupCode = StringOperation.QueryStringInt16Value(Request.QueryString["ProductGroupCode"]);
        #endregion

        int ProductId = Convert.ToInt32(lblProductId.Text);
        int SectionCode = Convert.ToInt32(lblSectionId.Text);

        if (ToSet == true)
        {
            ExpiryDate = Convert.ToDateTime(txtStartDate.Text);
            taProductMainPageSection.Prc_update_ProductMainPageSection(CompanyId, CategoryId, SubCategoryId, ProductGroupCode, SectionCode, ProductId, ExpiryDate);
        }
        else if (ToRemove == true)
            taProductMainPageSection.Prc_RemoveExpiryDate_ProductMainPageSection(CompanyId, CategoryId, SubCategoryId, ProductGroupCode, SectionCode, ProductId);

        Response.Redirect("MainPageSectionDetail.aspx?CompanyId=" + CompanyId + "&CategoryId=" + CategoryId + "&SubCategoryId=" + SubCategoryId + "&ProductGroupCode=" + ProductGroupCode);

        this.ModalPopupExtender1.Hide();
    }