protected void Page_Load(object sender, EventArgs e)
        {
            // h4DivHead.InnerText = "List of Request Template";
            UCFormHeader1.FormHeaderText = "Request Template";
            //Toolbar1.SetUserRights("MaterialRequest", "Summary", "");
            //  FillSites();
            if (!IsPostBack)
            {
                if (Session["Lang"] == null)
                {
                    Session["Lang"] = Request.UserLanguages[0];
                }
                loadstring();

                FillSites();

                iPartRequestClient objService = new iPartRequestClient();
                CustomProfile      profile    = CustomProfile.GetProfile();

                tbTemplateLst.Visible    = true;
                tbTemplateDetail.Visible = false;
                tabContainerReqTemplate.ActiveTabIndex = 0;
                objService.ClearTempDataFromDBNEW(HttpContext.Current.Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, profile.DBConnection._constr);
            }
            GetTemplateList();
            //Toolbar1.SetSaveRight(false, "Not Allowed");
            //Toolbar1.SetClearRight(false, "Not Allowed");

            this.UCToolbar1.evClickAddNew += pageAddNew;
            this.UCToolbar1.evClickSave   += pageSave;
            this.UCToolbar1.evClickClear  += pageClear;
        }
        protected void pageAddNew(Object sender, BrilliantWMS.ToolbarService.iUCToolbarClient e)
        {
            iPartRequestClient objService = new iPartRequestClient();
            CustomProfile      profile    = CustomProfile.GetProfile();

            clearfields();
            txtTitle.Focus();
            tbTemplateLst.Visible    = false;
            tbTemplateDetail.Visible = true;
            tabContainerReqTemplate.ActiveTabIndex = 1;
            hdnTemplateID.Value = "";
            objService.ClearTempDataFromDBNEW(Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, profile.DBConnection._constr);
        }
        protected void Grid1_OnRebind(object sender, EventArgs e)
        {
            iPartRequestClient objService = new iPartRequestClient();

            try
            {
                Grid1.DataSource = null;
                Grid1.DataBind();
                CustomProfile profile = CustomProfile.GetProfile();
                HiddenField   hdn     = (HiddenField)UCProductSearch1.FindControl("hdnProductSearchSelectedRec");
                List <POR_SP_GetPartDetail_ForRequest_Result> RequestPartList = new List <POR_SP_GetPartDetail_ForRequest_Result>();
                if (hdn.Value == "")
                {
                    RequestPartList = objService.GetExistingTempDataBySessionIDObjectName(Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, profile.DBConnection._constr).ToList();
                }
                else if (hdn.Value != "")
                {
                    RequestPartList = objService.AddPartIntoRequest_TempData(hdn.Value, Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, 0, profile.DBConnection._constr).ToList();
                }

                ////Add by Suresh
                //if (hdnprodID.Value != "")
                //{
                //    RequestPartList = objService.AddPartIntoRequest_TempData(hdnprodID.Value, Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, Convert.ToInt32(ddlSites.SelectedItem.Value), profile.DBConnection._constr).ToList();
                //    hdnprodID.Value = "";
                //}

                if (hdnChngDept.Value == "0x00x0")
                {
                    objService.ClearTempDataFromDBNEW(HttpContext.Current.Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, profile.DBConnection._constr);
                    RequestPartList = null;
                }
                hdnChngDept.Value = "";
                var chngdpt = "1x1";
                hdnChngDept.Value = chngdpt;

                Grid1.DataSource = RequestPartList;
                Grid1.DataBind();
            }
            catch (System.Exception ex)
            {
                Login.Profile.ErrorHandling(ex, this, "Request Template", "Grid1_OnRebind");
            }
            finally { objService.Close(); }
        }