Ejemplo n.º 1
0
        public static void BindZoneLookup(ctlDropDownList ddl, ContextInfo SessionContext)
        {
            var list = new SharedRepository(SessionContext).GetZoneLookup().ToList();

            ddl.DataSource     = list;
            ddl.DataValueField = "ZoneId";
            ddl.DataTextField  = "ZoneName";
            ddl.DataBind();
        }
Ejemplo n.º 2
0
        public static void BindSiteLookup(ctlDropDownList ddl, ContextInfo SessionContext, long ClusterId)
        {
            var list = new SharedRepository(SessionContext).GetSiteLookup().Where(x => x.ClusterId == ClusterId).ToList();

            ddl.DataSource     = list;
            ddl.DataValueField = "SiteId";
            ddl.DataTextField  = "SiteName";
            ddl.DataBind();
        }
Ejemplo n.º 3
0
        public static void BindHubLookup(ctlDropDownList ddl, ContextInfo SessionContext, long BranchId)
        {
            var list = new SharedRepository(SessionContext).GetHubLookup().Where(x => x.BranchId == BranchId).ToList();

            ddl.DataSource     = list;
            ddl.DataValueField = "HubId";
            ddl.DataTextField  = "HubName";
            ddl.DataBind();
        }
Ejemplo n.º 4
0
        public static void BindYearLookup(ctlDropDownList ddl)
        {
            Dictionary <int, int> yearList = new Dictionary <int, int>();

            yearList.Add(DateTime.Now.Year, DateTime.Now.Year);
            yearList.Add(DateTime.Now.Year - 1, DateTime.Now.Year - 1);

            ddl.DataSource     = yearList;
            ddl.DataValueField = "Key";
            ddl.DataTextField  = "Value";
            ddl.DataBind();
        }
Ejemplo n.º 5
0
        public static void SetLookupSelectedText(ctlDropDownList ctlDropDownList, string strSelectedText)
        {
            for (int index = 0; index <= ctlDropDownList.Items.Count - 1; index++)
            {
                if (ctlDropDownList.Items[index].Text.ToLower().Trim() == strSelectedText.ToLower())
                {
                    ctlDropDownList.SelectedIndex = index;

                    break;
                }
            }
        }
Ejemplo n.º 6
0
        public static void SetLookupSelectedValue(ctlDropDownList ctlDropDownList, string strSelectedValue)
        {
            bool flag = false;

            for (int index = 0; index <= ctlDropDownList.Items.Count - 1; index++)
            {
                if (ctlDropDownList.Items[index].Value.ToLower().Trim() == strSelectedValue.ToLower().Trim())
                {
                    ctlDropDownList.SelectedIndex = index;

                    flag = true;

                    break;
                }
            }

            if (flag == false)
            {
                if (ctlDropDownList.SelectedIndex != -1)
                {
                    ctlDropDownList.SelectedIndex = 0;
                }
            }
        }