示例#1
0
        protected override void OnPreRender(EventArgs e)
        {
            if (!IsPostBack)
            {
                string[]  colAlias  = SampleConstants.BoundDataColumns;
                ArrayList ThemeList = new ArrayList();
                ThemesAndModifiers.FillThemeNames(ThemeList);

                DropDownList1.Items.Clear();
                DropDownList1.DataSource = ThemeList;
                DropDownList1.DataBind();

                // Prepare CheckBoxes, RadioButtons and note label contents.
                CheckBoxList1.DataSource = colAlias;
                CheckBoxList1.DataBind();
                CheckBoxList1.Visible = this.IsCheckBoxListVisible(ThemeList[0] as string);

                RadioButtonList1.DataSource = colAlias;
                RadioButtonList1.DataBind();
                RadioButtonList1.Visible = this.IsRadioButtonListVisible(ThemeList[0] as string);

                Label2.Visible = this.IsNoteLabelVisible(ThemeList[0] as string);
                Label2.Text    = "Please select two columns from below checkboxes.";

                DropDownList1.Items.Clear();
                DropDownList1.DataSource = ThemeList;
                DropDownList1.DataBind();
            }
        }
示例#2
0
 private void departmentList1_SelectedIndexChanged(object sender, System.EventArgs e)
 {
     if (this.departmentList1.SelectedValue == "0")
     {
         this.divisionList.Items.Clear();
         ListItem itm = new ListItem("--Select Department--", "0");
         this.divisionList.Items.Add(itm);
     }
     else
     {
         int departmentId = Convert.ToInt32(this.departmentList1.SelectedValue);
         System.Data.DataSet divisionSet = Utilites.Division.GetDivision(departmentId);
         divisionList.DataSource     = divisionSet;
         divisionList.DataTextField  = "Division";
         divisionList.DataValueField = "DivisionId";
         divisionList.DataBind();
         this.divisionList.DataSource = Utilites.Division.GetDivision(departmentId);
         this.divisionList.DataBind();
         ListItem itm2 = new ListItem("--General--", "0");
         this.divisionList.Items.Insert(0, itm2);
         if (this.divisionList.Items.Count == 0)
         {
             ListItem itm = new ListItem("--Select Department--", "0");
             this.divisionList.Items.Add(itm);
         }
     }
     lblErrorMessage.Visible = false;
 }
示例#3
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            // 在此处放置用户代码以初始化页面
            //this.btnExcel.Attributes.Add("onclick","javascript:window.open('DataGridToExcel.aspx', 'Sample', 'toolbar=no,location=no,directories=no,status=yes,menubar=yes,scrollbars=no,resizable=yes,copyhistory=yes,width=790,height=520,left=0,top=0')");
            if (!IsPostBack)
            {
                //BindDeptAll(ddlProvideCompany);
                BindDept(ddlProvideCompany, "所有", "%");
                BindDeptAll(ddlDeliveryCompany);
                UcPageView1.DebindGrid();

                DataTable dtGoodsName = ReportQueryFacade.CommonQuery("select * from tbCommCode where cnvcCommSign='GoodsName'");


                ddlGoodsName.DataSource     = dtGoodsName;
                ddlGoodsName.DataTextField  = "cnvcCommName";
                ddlGoodsName.DataValueField = "cnvcCommCode";
                ddlGoodsName.DataBind();

                ListItem liAll = new ListItem("所有", "%");
                ddlGoodsName.Items.Insert(0, liAll);

                if (ddlGoodsName.SelectedItem.Text != "所有")
                {
                    DataTable dtGoodsType = ReportQueryFacade.CommonQuery("select * from tbCommCode where cnvcCommSign='GoodsType" + ddlGoodsName.SelectedValue + "'");
                    ddlGoodsType.DataSource     = dtGoodsType;
                    ddlGoodsType.DataTextField  = "cnvcCommName";
                    ddlGoodsType.DataValueField = "cnvcCommCode";
                    ddlGoodsType.DataBind();
                }
                else
                {
                    DataTable dtGoodsType = ReportQueryFacade.CommonQuery("select * from tbCommCode where cnvcCommSign='GoodsTypeCY' or cnvcCommSign='GoodsTypeQY'");
                    ddlGoodsType.DataSource     = dtGoodsType;
                    ddlGoodsType.DataTextField  = "cnvcCommName";
                    ddlGoodsType.DataValueField = "cnvcCommCode";
                    ddlGoodsType.DataBind();
                }

                //ListItem li = new ListItem("所有","%");
                ddlGoodsType.Items.Insert(0, liAll);

//				if ( null != Session[ConstValue.LOGIN_DEPT_SESSION])
//				{
//					Dept dept = (Dept)Session[ConstValue.LOGIN_DEPT_SESSION];
//					if (dept.cnvcDeptID != "00")
//					{
//						ListItem li = ddlDeliveryCompany.Items.FindByText(dept.cnvcDeptName);
//						ddlDeliveryCompany.SelectedIndex = ddlDeliveryCompany.Items.IndexOf(li);
//						ddlDeliveryCompany.Enabled = false;
//
////						ListItem li2 = ddlProvideCompany.Items.FindByText(dept.cnvcDeptName);
////						ddlProvideCompany.SelectedIndex = ddlProvideCompany.Items.IndexOf(li2);
////						ddlProvideCompany.Enabled = false;
//					}
//				}
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                Trace.Write("starting Page Load");
                if (Session["TableDataSet"] != null)
                {
                    DataSet tds = Session["TableDataSet"] as DataSet;
                    Trace.Write(tds.ToString());
                    var tablenames = GetTablenames(tds.Tables);
                    sheetCombo.DataSource = tablenames;
                    sheetCombo.DataBind();
                    GridView1.DataSource = tds.Tables[sheetCombo.SelectedIndex];
                    GridView1.DataBind();
                    //columnCombo.DataSource = tds.Tables[sheetCombo.SelectedIndex].Columns;
                    //columnCombo.DataBind();
                    //Get the list of columns to be assigned from DB

                    foreach (DataColumn columnName in tds.Tables[sheetCombo.SelectedIndex].Columns)
                    {
                        Label myLabel = new Label();
                        myLabel.Text = columnName.ToString();
                        myLabel.ID = columnName.ToString() +"label";
                        myLabel.Width = 120;
                        myLabel.Height = 28;
                        columnPanel.Controls.Add(myLabel);

                        DropDownList myDropDownList = new DropDownList();
                        myDropDownList.ID = columnName.ToString() + "combo";

                        //Remove this once table lookup in place.
                        myDropDownList.DataSource = tds.Tables[sheetCombo.SelectedIndex].Columns;
                        myDropDownList.DataBind();

                        //need to load data to control.  Following code is for proof of concept.

                        Trace.Warn("starting DB read");

                        myDropDownList.DataSource = dsColumn;
                        myDropDownList.Height = 28;
                        myDropDownList.DataValueField = "COLUMNCONFIG_IDX";
                        myDropDownList.DataTextField = "COLUMN_NAME";
                        myDropDownList.DataBind();

                        columnPanel.Controls.Add(myDropDownList);
                        //columnPanel.Controls.Add(new LiteralControl("<br/>"));
                    }
                }
            }
            catch (Exception ex)
            {
                Trace.Warn("error caught.  " + ex.Message);
                //catch error code
            }
        }
        private void LoadUtenti()
        {
            DataSet Ds = _Dest.GetUtenti(Int16.Parse(DrEdifici.SelectedValue));

            this.CmbUtente.DataSource = Classi.GestoreDropDownList.ItemBlankDataSource(
                Ds.Tables[0], "descrizione", "id", "-Selezionare un valore-", "0");
            CmbUtente.DataTextField  = "Descrizione";
            CmbUtente.DataValueField = "id";
            CmbUtente.DataBind();

            CmbUtente.DataTextField  = "Descrizione";
            CmbUtente.DataValueField = "id";
            CmbUtente.DataBind();
        }
示例#6
0
 /// <summary>
 /// Set the selected value of a drop down.
 /// </summary>
 /// <param name="dropDownList"></param>
 /// <param name="data"></param>
 public static void BindDropDownDataSource(DropDownList dropDownList, ICollection data)
 {
     try
     {
         dropDownList.DataSource = data;
         dropDownList.DataBind();
     }
     catch (ArgumentOutOfRangeException)
     {
         dropDownList.Items.Clear();
         dropDownList.SelectedValue = null;
         dropDownList.DataSource = data;
         dropDownList.DataBind();
     }
 }
示例#7
0
 public static void CreateDropDownList(DropDownList ddl_object, DataSet ds, string s_text, string s_value)
 {
     ddl_object.DataSource = ds;
     ddl_object.DataTextField = s_text;
     ddl_object.DataValueField = s_value;
     ddl_object.DataBind();
 }
示例#8
0
 /// <summary>
 /// Utility function to set data source of a drop down control.
 /// </summary>
 /// <param name="dropDown"></param>
 /// <param name="dataSource"></param>
 public static void SetDataSource(DropDownList dropDown, IList dataSource)
 {
     dropDown.DataSource = dataSource;
     dropDown.DataTextField = "DisplayMember";
     dropDown.DataValueField = "ValueMember";
     dropDown.DataBind();
 }
        public void BindContactTitle(DropDownList _ddlContactTitles)
        {
            ContactServiceClient contactService = null;
            try
            {
                contactService = new ContactServiceClient();
                CollectionRequest collectionRequest = new CollectionRequest();
                collectionRequest.StartRow = 0;

                TitleSearchCriteria titleCriteria = new TitleSearchCriteria();
                TitleSearchReturnValue titleReturnValue = contactService.TitleSearch(_logonSettings.LogonId, collectionRequest, titleCriteria);
                if (titleReturnValue.Title != null)
                {
                    _ddlContactTitles.DataSource = titleReturnValue.Title.Rows;
                    _ddlContactTitles.DataTextField = "TitleId";
                    _ddlContactTitles.DataValueField = "TitleId";
                    _ddlContactTitles.DataBind();
                }
                AddDefaultToDropDownList(_ddlContactTitles);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (contactService != null)
                {
                    if (contactService.State != System.ServiceModel.CommunicationState.Faulted)
                        contactService.Close();
                }
            }
        }
 public void fillDropdownlistWithDT(DropDownList ddl, DataTable dt, String id, String title)
 {
     ddl.DataSource = dt;
     ddl.DataValueField = id;
     ddl.DataTextField = title;
     ddl.DataBind();
 }
示例#11
0
文件: Common.cs 项目: ErekTan/HLedo
 /// <summary>
 /// 绑定一个DropDownList
 /// </summary>
 /// <param name="ddl">DropDownList实例</param>
 /// <param name="ddlText">DropDownList显示文本</param>
 /// <param name="ddlValue">DropDownList值</param>
 /// <param name="className">类名称</param>
 /// <param name="methodName">要调用的方法</param>
 /// <param name="parameterValue">参数值</param>
 public static void BindDropDownList(DropDownList ddl, string ddlText, string ddlValue, object className, string methodName, string parameterValue)
 {
     ddl.DataSource = CallMethod(className, methodName, parameterValue);
     ddl.DataTextField = ddlText;
     ddl.DataValueField = ddlValue;
     ddl.DataBind();
 }
		protected override Control AddEditor(Control container)
		{
			IEnumerable<ProductBrief> productBriefs;
			try
			{
                ShopperApiClientHelperForN2Admin.AssureLimitedAuthentication(false);
                productBriefs = Context.Current.Container.Resolve<ICatalogApi>().GetProductBriefsAsync().Result;
			}
			catch
			{   // TODO - better error handling, e.g. show an input box 
                productBriefs = new ProductBrief[0];
			}

			// here we create the editor control and add it to the page
			var list = new DropDownList
						   {
							   ID = Name,
							   DataTextField = "IdAndName",
							   DataValueField = "Id",
                               DataSource = productBriefs
						   };
			list.DataBind();
			container.Controls.Add(list);
			return list;
		}
 public void BindDropdownlist(DropDownList dropdownlist, IEnumerable dataSource, string textField, string valueField)
 {
     dropdownlist.DataTextField = "TextField";
     dropdownlist.DataValueField = "ValueField";
     dropdownlist.DataSource = dataSource;
     dropdownlist.DataBind();
 }
示例#14
0
 public void setDropdownList(DropDownList ddl, DataSet ds, string display, string value)
 {
     ddl.DataSource = ds;
     ddl.DataTextField = display;
     ddl.DataValueField = value;
     ddl.DataBind();
 }
示例#15
0
 //public void SetCheckBoxListForMemberList(List<Design> oLists, CheckBoxList oBoxList)
 //{
 //    foreach (Design oList in oLists)
 //    {
 //        ListItem oItem = new ListItem();
 //        oItem.Text = oList.ColumnName.ToString();
 //        oBoxList.Items.Add(oItem);
 //    }
 //}
 public void SetDatasetToDropDownList(DataSet oDS, DropDownList oDDL, String TextField, String IDField)
 {
     oDDL.DataSource = oDS;
     oDDL.DataTextField = TextField;
     oDDL.DataValueField = IDField;
     oDDL.DataBind();
 }
        private void LoadDestinationModules()
        {
            if (SourceInstance.SelectedIndex > -1)
            {
                DestinationInstance.Items.Clear();

                //Get the Module Type(ex announcements) and the Source ModuleID
                int ModuleTypeID = Int32.Parse(ModuleTypes.SelectedItem.Value);
                int SourceModID  = Int32.Parse(SourceInstance.SelectedItem.Value);

                ContentManagerDB contentDB = new ContentManagerDB();

                DestinationInstance.DataValueField = "ModuleID";
                DestinationInstance.DataTextField  = "TabModule";
                DestinationInstance.DataSource     = contentDB.GetModuleInstancesExc(ModuleTypeID,
                                                                                     SourceModID, Int32.Parse(DestinationPortal.SelectedItem.Value));
                DestinationInstance.DataBind();

                //if any items exist in destination instance dropdown, select first and
                //load data for that instance.
                if (DestinationInstance.Items.Count > 0)
                {
                    DestinationInstance.SelectedIndex = 0;
                    LoadDestinationModuleData();
                }
            }
        }
        /// --------------------------------------------------------
        public void LoadRefData()
        {
            BizContactType contactType = new BizContactType();

            contactType.List();
            selContactTypeID.DataValueField = "ContactTypeID";
            selContactTypeID.DataTextField  = "ContactTypeID";
            selContactTypeID.DataSource     = contactType;
            selContactTypeID.DataBind();
            DesignedNet.Framework.Web.Common.CreateSelectOneItem(selContactTypeID.Items);

            BizContactStatus contactStatus = new BizContactStatus();

            contactStatus.List();
            selContactStatusID.DataValueField = "ContactStatusID";
            selContactStatusID.DataTextField  = "ContactStatusID";
            selContactStatusID.DataSource     = contactStatus;
            selContactStatusID.DataBind();
            DesignedNet.Framework.Web.Common.CreateSelectOneItem(selContactStatusID.Items);

            BizCompany company = new BizCompany();

            company.List();
            selCompanyID.DataValueField = "CompanyID";
            selCompanyID.DataTextField  = "CompanyID";
            selCompanyID.DataSource     = company;
            selCompanyID.DataBind();
            DesignedNet.Framework.Web.Common.CreateSelectOneItem(selCompanyID.Items);
        }
示例#18
0
/**
 */
        public void BindData()
        {
            //declare variables
            string strSQL;
            string myConnectString;

            //Create connect string
            myConnectString = ConfigurationManager.ConnectionStrings["myConn"].ConnectionString;;

            //Build SQL statement
            strSQL = "SELECT * FROM LK_Category";

            SqlConnection myConnection = new SqlConnection(myConnectString);

            // Read sample item info from SQL into a DataSet
            DataSet dsItems = new DataSet();

            SqlDataAdapter objAdapter = new SqlDataAdapter(strSQL, myConnection);

            objAdapter.TableMappings.Add("Table", "tblCat");

            objAdapter.Fill(dsItems);

            cboCategory.DataSource     = dsItems;
            cboCategory.DataMember     = "tblCat";
            cboCategory.DataTextField  = "Category";
            cboCategory.DataValueField = "iD";
            cboCategory.DataBind();
            cboCategory.SelectedIndex = (int)0;

            myConnection.Close();
        }
示例#19
0
        public void CompanyDropDrownListLoad(DropDownList ddl,Boolean onlyCode,Boolean limitState,Boolean noSelected,string default_ )
        {
            StringBuilder sql = new StringBuilder();
            if (onlyCode)
            {
                sql.Append("select company_id,cimpany_id company from jp_company");
            }
            else
            {
                sql.Append("select company_id,company_id||' '||company company from jp_company");
            }
            if (limitState)
            {
                sql.Append(" where state='1'");
            }
            if (noSelected)
            {
                ddl.DataSource = DBHelper.createDDLView(sql.ToString());
            }
            else
            {
                ddl.DataSource = DBHelper.createGridView(sql.ToString());
            }
            ddl.DataTextField = "company";
            ddl.DataValueField = "company_id";
            ddl.DataBind();

            if (default_ != string.Empty)
            {
                ddl.SelectedIndex = ddl.Items.IndexOf(ddl.Items.FindByValue(default_));
            }
        }
        /// <summary>
        /// The Page_Load event handler on this User Control populates the comboboxes
        /// for portals and module types for the ContentManager.
        /// It uses the Rainbow.ContentManagerDB()
        /// data component to encapsulate all data functionality.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (!IsPostBack)
            {
                //populate module types dropdownlist.
                ContentManagerDB contentDB = new ContentManagerDB();

                //populate moduleTypes list
                ModuleTypes.DataSource     = contentDB.GetModuleTypes();
                ModuleTypes.DataValueField = "ItemID";
                ModuleTypes.DataTextField  = "FriendlyName";
                ModuleTypes.DataBind();

                //populate source portal list
                SourcePortal.DataValueField = "PortalID";
                SourcePortal.DataTextField  = "PortalAlias";
                SourcePortal.DataSource     = contentDB.GetPortals();
                SourcePortal.DataBind();

                //destination portal list.
                DestinationPortal.DataValueField = "PortalID";
                DestinationPortal.DataTextField  = "PortalAlias";
                DestinationPortal.DataSource     = contentDB.GetPortals();
                DestinationPortal.DataBind();

                //Function to set visibility for Portal dropdowns and select current portal
                //as default
                MultiPortalSupport();

                //functions to load the modules in the currently selected portal.
                LoadSourceModules();
                LoadDestinationModules();
            }
        }
示例#21
0
        private void fillProjectDropDownList()
        {
            // build project drop down list and
            // select list item that has value = id (if value != null)
            DataSet ds = new DataSet();

            ds = Project.getProjectsDataSet(Request.Cookies["user"]["id"]);
            //create a datatable to fill the dropdown list from
            DataTable dt = ds.Tables[0];

            //fill the dropdown list
            ProjectDropDownList.DataSource     = dt.DefaultView;
            ProjectDropDownList.DataTextField  = "name";
            ProjectDropDownList.DataValueField = "id";
            ProjectDropDownList.DataBind();
            ProjectDropDownList.Items.Insert(0, "");

            // select parent Project
            if (parentID != null)
            {
                ProjectDropDownList.SelectedIndex
                    = ProjectDropDownList.Items.IndexOf(
                          ProjectDropDownList.Items.FindByValue(parentProject.ID));
                ProjectDropDownList.Enabled = false;

                if (itemType.Equals(ProjectItem.ItemType.TASK))
                {
                    fillModuleDropDownList();
                }
            }
        }
示例#22
0
        private void fillModuleDropDownList()
        {
            //build the module list
            //create a data set
            DataSet ds = new DataSet();

            //ds = Module.getModulesDataSet(ProjectDropDownList.SelectedValue);
            ds = parentProject.getModulesDataSet();
            //create a datatable to fill the dropdown list from
            DataTable dt = ds.Tables[0];

            //fill the dropdown list
            ModuleDropDownList.DataSource     = dt.DefaultView;
            ModuleDropDownList.DataTextField  = "name";
            ModuleDropDownList.DataValueField = "id";
            ModuleDropDownList.DataBind();
            ModuleDropDownList.Items.Insert(0, "");

            // select parent Module
            if (parentID != null)
            {
                ModuleDropDownList.SelectedIndex
                    = ModuleDropDownList.Items.IndexOf(
                          ModuleDropDownList.Items.FindByValue(parentModule.ID));
                ModuleDropDownList.Enabled = false;
            }
        }
示例#23
0
        private void ProjectDropDownList_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            //create a data set
            DataSet ds = Module.getModulesDataSet(ProjectDropDownList.SelectedValue);

            DataTable dt = new DataTable();

            dt = ds.Tables[0];

            enableProjectControls(true);
            enableModuleControls(true);

            //fill the dropdown list
            ModuleDropDownList.DataSource     = dt.DefaultView;
            ModuleDropDownList.DataTextField  = "name";
            ModuleDropDownList.DataValueField = "ID";
            ModuleDropDownList.DataBind();
            ModuleDropDownList.Items.Insert(0, "");

            // disable and clear the task drop down
            enableTaskControls(false);
            if (TaskDropDownList.Items.Count > 0)
            {
                TaskDropDownList.Items.Clear();
            }
        }
        private void BindList(DropDownList ddl, EnumItemDescriptionList list)
        {
            ddl.DataSource = list;
            ddl.DataTextField = "Description";
			ddl.DataValueField = "EnumValue";
            ddl.DataBind();
        }
示例#25
0
 public void cargarCursosDropDownList(profesor _p, ref DropDownList dp)
 {
     dp.DataSource = _p.curso.ToList();
     dp.DataTextField = "nombre";
     dp.DataValueField = "id_curso";
     dp.DataBind();
 }
示例#26
0
 public static void BindData(ref DropDownList ddl, object obj, string text, string value)
 {
     ddl.DataSource = obj;
     ddl.DataTextField = text;
     ddl.DataValueField = value;
     ddl.DataBind();
 }
        /// <summary>
        /// The BindData helper method is used to bind the list of
        /// security roles for this portal to an asp:datalist server control
        /// </summary>
        private void BindData()
        {
            // unhide the Windows Authentication UI, if application
            if (User.Identity.AuthenticationType != "Forms")
            {
                windowsUserName.Visible = true;
                addNew.Visible          = true;
            }

            // add the role name to the title
            if (roleName != string.Empty)
            {
                // Added EsperantusKeys for Localization
                // Mario Endara [email protected] june-1-2004
                title.InnerText = Esperantus.Localize.GetString("ROLE_MEMBERSHIP") + roleName;
            }

            // Get the portal's roles from the database
            UsersDB users = new UsersDB();

            // bind users in role to DataList
            System.Data.SqlClient.SqlDataReader drRoles = users.GetRoleMembers(roleID);
            usersInRole.DataSource = drRoles;
            usersInRole.DataBind();
            drRoles.Close();             //by Manu, fixed bug 807858

            // bind all portal users to dropdownlist
            System.Data.DataSet drUsers = users.GetUsers(portalSettings.PortalID);
            allUsers.DataSource = drUsers;
            allUsers.DataBind();
        }
        /// <summary>
        /// Get the current DB data and fill
        /// the fields with them
        /// </summary>
        private void BindFields()
        {
            // Header.SurveyId = SurveyId;
            ((Wap)Master.Master).HeaderControl.SurveyId = SurveyId;
            CreateTypeHyperLink.NavigateUrl             = UINavigator.TypeCreator + "?surveyid=" + SurveyId + "&menuindex=" + MenuIndex;
            if (NSurveyUser.Identity.IsAdmin)
            {
                TypesDropDownList.DataSource = new AnswerTypes().GetEditableAnswerTypesList();
            }
            else
            {
                TypesDropDownList.DataSource = new AnswerTypes().GetEditableAssignedAnswerTypesList(NSurveyUser.Identity.UserId);
            }

            TypesDropDownList.DataMember     = "AnswerTypes";
            TypesDropDownList.DataTextField  = "Description";
            TypesDropDownList.DataValueField = "AnswerTypeID";
            TypesDropDownList.DataBind();
            TranslateListControl(TypesDropDownList);

            if (TypesDropDownList.Items.Count > 0)
            {
                TypesDropDownList.Items.Insert(0,
                                               new ListItem(GetPageResource("SelectTypeMessage"), "0"));
            }
            else
            {
                TypesDropDownList.Items.Insert(0,
                                               new ListItem(GetPageResource("CreateATypeMessage"), "0"));
            }
        }
示例#29
0
        private void LibraryDropDownList_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if (SurveyListDropdownlist.SelectedValue == "-1")
            {
                LibraryQuestionsDropDownList.Visible = false;
                LibraryQuestionsDropDownList.Items.Clear();
                CopyExistingQuestionButton.Enabled = false;
            }
            else
            {
                LibraryQuestionsDropDownList.Visible = true;

                QuestionData questions = new Questions().GetLibraryQuestionListWithoutChilds(int.Parse(LibraryDropDownList.SelectedValue));
                if (questions.Questions.Rows.Count > 0)
                {
                    LibraryQuestionsDropDownList.DataSource     = questions;
                    LibraryQuestionsDropDownList.DataMember     = "questions";
                    LibraryQuestionsDropDownList.DataTextField  = "questionText";
                    LibraryQuestionsDropDownList.DataValueField = "questionid";
                    LibraryQuestionsDropDownList.DataBind();
                    CopyExistingQuestionButton.Enabled = true;
                }
                else
                {
                    LibraryQuestionsDropDownList.Items.Clear();
                    LibraryQuestionsDropDownList.Items.Insert(0, new ListItem(GetPageResource("NoQuestionToCopyAvailableMessage"), "-1"));
                }
            }
        }
        /// <summary>
        /// Binds A Control That Is Past To It With A Portals Roles
        /// </summary>
        /// <param name="dropDown"></param>
        /// <param name="addNoRoles"></param>
        private void BindRoleData(System.Web.UI.WebControls.DropDownList dropDown, bool addNoRoles)
        {
            // Get the portal's roles from the database

            System.Data.SqlClient.SqlDataReader roleDataReader = users.GetPortalRoles(portalSettings.PortalID);

            dropDown.DataSource     = roleDataReader;
            dropDown.DataTextField  = "RoleName";
            dropDown.DataValueField = "RoleID";
            dropDown.DataBind();
            if (addNoRoles)
            {
                dropDown.Items.Add("Not In Any Role");
            }

            roleDataReader.Close();

            if (PortalSecurity.IsInRoles("Admins") == false)
            {
                // Added by Mario Endara <*****@*****.**> 2004/11/04
                // if the user is not member of the "Admins" role, remove it from the dropdownlist
                if (dropDown.Items.FindByText("Admins") != null)
                {
                    dropDown.Items.Remove(dropDown.Items.FindByText("Admins"));
                }
            }
        }
示例#31
0
 public void FillCmb(String str, Object ItemArray, string FirstR, System.Web.UI.WebControls.DropDownList DropDownName)
 {
     try
     {
         if (con.State == ConnectionState.Closed)
         {
             con.Open();
         }
         DataTable dt = new DataTable();
         dt.Clear();
         DataRow        drow;
         SqlDataAdapter da = new SqlDataAdapter(str, con);
         da.Fill(dt);
         drow           = dt.NewRow();
         drow.ItemArray = new object[] { FirstR, 0 };
         dt.Rows.InsertAt(drow, 0);
         DropDownName.DataSource     = dt;
         DropDownName.DataValueField = dt.Columns[1].ToString();
         DropDownName.DataTextField  = dt.Columns[0].ToString();
         DropDownName.DataBind();
         con.Close();
     }
     catch (Exception ex)
     {
         // MessageBox.Show(ex.Message);
     }
 }
示例#32
0
        private bool completarCampos(string idiomaID, string rut)
        {
            int i = System.Convert.ToInt32(idiomaID);

            idiomaID = i.ToString();
            string sql = "SELECT * FROM " + tabla + "idiomas WHERE idiomaID = '" + idiomaID + "' AND rut = '" + rut + "';";

            System.DateTime dateTime = System.DateTime.Now;
            Trace.Write(dateTime.ToString() + " OK/EGRESADOidiomas / CompletarCampos");
            System.Data.SqlClient.SqlConnection adoConn = new System.Data.SqlClient.SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["BaseSqlServer"].ConnectionString);
            adoConn.Open();
            System.Data.SqlClient.SqlCommand adoCmd = new System.Data.SqlClient.SqlCommand(sql, adoConn);
            Trace.Write(sql);
            System.Data.SqlClient.SqlDataReader dr = adoCmd.ExecuteReader();
            if (dr.Read())
            {
                this.idiomaID.DataBind();
                oral.DataBind();
                escrito.DataBind();
                this.idiomaID.SelectedIndex = this.idiomaID.Items.IndexOf(this.idiomaID.Items.FindByValue(dr["idiomaID"].ToString()));
                oral.SelectedIndex          = oral.Items.IndexOf(oral.Items.FindByValue(dr["oral"].ToString()));
                escrito.SelectedIndex       = escrito.Items.IndexOf(escrito.Items.FindByValue(dr["escrito"].ToString()));
                this.idiomaID.Enabled       = false;
            }
            else
            {
                return(false);
            }
            return(true);
        }
示例#33
0
        internal static void BindListInternal(DropDownList comboBox, object value, IEnumerable listSource, string textField, string valueField)
        {
            if (comboBox != null)
            {
                string selectedValue = !comboBox.Page.IsPostBack ? Convert.ToString(value) : comboBox.SelectedValue;

                if (listSource is Dictionary<string, string>)
                {
                    var items = listSource as Dictionary<string, string>;
                    foreach (var item in items)
                    {
                        comboBox.Items.Add(new ListItem(item.Key, item.Value));
                    }
                }
                else
                {
                    comboBox.DataTextField = textField;
                    comboBox.DataValueField = valueField;
                    comboBox.DataSource = listSource;

                    comboBox.DataBind();
                }

                //Reset SelectedValue
                comboBox.Select(selectedValue);
            }
        }
 public bool LlenarCombo_Web( DropDownList Generico )
 {
     if ( ! Validar() )
             return false;
         clsConexionBD objConexionBd = new clsConexionBD( strApp );
         try
         {
             objConexionBd.SQL = strSQL;
             if ( ! objConexionBd.LlenarDataSet( false ) )
             {
                 strError = objConexionBd.Error;
                 objConexionBd.CerrarCnx();
                 objConexionBd = null;
                 return false;
             }
             Generico.DataSource = objConexionBd.DataSet_Lleno.Tables[0];
             Generico.DataValueField = strCampoID;
             Generico.DataTextField = strCampoTexto;
             Generico.DataBind();
             objConexionBd.CerrarCnx();
             objConexionBd = null;
             return true;
         }
         catch (Exception ex)
         {
             strError = ex.Message;
             return false;
         }
 }
 /// <summary>
 /// Fills dropdownlist list with data from dataSource     
 /// <param name="list"></param>
 /// <param name="dataSource"></param>
 /// <param name="needEmpty">Indicates if we have to add empty element to dropDownList</param>
 /// <param name="dataValueField">value</param>
 /// <param name="dataTextField">text</param>
 /// <param name="emptyText">displayed text in emptyElement </param>
 public void FillDropDownList(DropDownList list, IEnumerable dataSource, String dataValueField = "", String dataTextField = "", bool needEmpty = false, String emptyText = "")
 {
     //if string[,] array is datasource
     if(dataSource.GetType() == typeof(System.String[,]))
     {
         list.DataSource = dataSource;
     }
     else //if any List<object> is datasource
     {
         list.DataSource = dataSource;
     }
     //if value or text fields are identified
     if(!string.IsNullOrEmpty(dataValueField))
     {
         list.DataValueField = dataValueField;
     }
     if(!string.IsNullOrEmpty(dataTextField))
     {
         list.DataTextField = dataTextField;
     }
     list.DataBind();
     //if we have to add an empty element to dropDownList
     if(needEmpty)
     {
         list.Items.Insert(0, new ListItem(emptyText, Constants.EpmtyDDLValue));
     }
 }
示例#36
0
        public static void BuildStudentProspectTable(Table table, string userId)
        {
            GroupService service = new GroupService();
            DataTable dtProspects = service.GetProspectiveStudentsData(userId);
            DataTable dtGroups = service.GetSupervisorOfData(userId);

            for (int i = 0; i < dtProspects.Rows.Count; i++)
            {
                DropDownList ddlGroupList = new DropDownList();
                ddlGroupList.DataSource = dtGroups;
                ddlGroupList.DataTextField = "GroupName";
                ddlGroupList.DataValueField = "GroupId";
                ddlGroupList.DataBind();
                ddlGroupList.Items.Insert(0, "Add a group");

                string name = dtProspects.Rows[i].ItemArray[0].ToString();
                string id = dtProspects.Rows[i].ItemArray[1].ToString();

                LinkButton b = new LinkButton();
                b.Text = name;
                b.CommandArgument = id;
                b.CommandName = name;

                TableRow row = new TableRow();
                TableCell cellProspects = new TableCell();
                TableCell cellGroups = new TableCell();

                cellProspects.Controls.Add(b);
                cellGroups.Controls.Add(ddlGroupList);
                row.Cells.Add(cellProspects);
                row.Cells.Add(cellGroups);
                table.Rows.Add(row);
            }
        }
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false);

                Session["PathToViewOrder"] = "EquipWOReport";

                if (!IsPostBack)
                {
                    dtCurrentDate     = DateTime.Now;
                    adtEndDate.Date   = dtCurrentDate;
                    adtStartDate.Date = dtCurrentDate.AddDays(-365);

                    order        = new clsWorkOrders();
                    order.iOrgId = OrgId;

                    dsRepairItemsCats = order.GetRepairItemsAndCats();

                    ddlRepairCats.DataSource = dsRepairItemsCats;
                    ddlRepairCats.DataBind();
                    ddlRepairCats.Items[0].Text = "All";

                    ddlWOTypes.DataSource = order.GetTypesList();
                    ddlWOTypes.DataBind();
                    ddlWOTypes.Items.Insert(0, new ListItem("All", "0"));

                    user               = new clsUsers();
                    user.iOrgId        = OrgId;
                    user.iTypeId       = (int)UserTypes.Technician;
                    ddlTech.DataSource = new DataView(user.GetUserListByType());
                    ddlTech.DataBind();
                    ddlTech.Items[0].Text = "All";

                    user.iTypeId            = (int)UserTypes.Operator;
                    ddlOperators.DataSource = new DataView(user.GetUserListByType());
                    ddlOperators.DataBind();
                    ddlOperators.Items[0].Text = "All";
                }
            }
            catch (Exception ex)
            {
                _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
                Session["lastpage"]     = "main.aspx";
                Session["error"]        = ex.Message;
                Session["error_report"] = ex.ToString();
                Response.Redirect("error.aspx", false);
            }
            finally
            {
                if (user != null)
                {
                    user.Dispose();
                }
                if (order != null)
                {
                    order.Dispose();
                }
            }
        }
        protected void Grid1_RowDataBound(object sender, GridRowEventArgs e)
        {
            System.Web.UI.WebControls.DropDownList ddlGender = (System.Web.UI.WebControls.DropDownList)Grid1.Rows[e.RowIndex].FindControl("ddlGender");

            List <string> genderList = new List <string>();

            genderList.Add("男");
            genderList.Add("女");
            ddlGender.DataSource = genderList;
            ddlGender.DataBind();


            DataRowView row = e.DataItem as DataRowView;

            int gender = Convert.ToInt32(row["Gender"]);

            if (gender == 1)
            {
                ddlGender.SelectedValue = "男";
            }
            else
            {
                ddlGender.SelectedValue = "女";
            }
        }
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false);

                if (!IsPostBack)
                {
                    instruct        = new clsInstructions();
                    instruct.iOrgId = OrgId;
                    dtTypes         = instruct.GetInstructionTypeList();
                    ddlInstructionTypes.DataSource = new DataView(dtTypes);
                    ddlInstructionTypes.DataBind();
                    ViewState["InstructionTypes"] = dtTypes;
                    dgInstructions.DataSource     = instruct.GetInstructionList();
                    dgInstructions.DataBind();
                }
            }
            catch (Exception ex)
            {
                _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
                Session["lastpage"]     = ParentPageURL;
                Session["error"]        = ex.Message;
                Session["error_report"] = ex.ToString();
                Response.Redirect("error.aspx", false);
            }
            finally
            {
                if (instruct != null)
                {
                    instruct.Dispose();
                }
            }
        }
        public static void load_data_to_cbo_bo_tinh(
            eTAT_CA ip_e_tat_ca
            , DropDownList ip_obj_cbo_bo_tinh)
        {
            US_DM_DON_VI v_us_dm_don_vi = new US_DM_DON_VI();
            DS_DM_DON_VI v_ds_dm_don_vi = new DS_DM_DON_VI();

            //v_us_dm_don_vi.FillDataset(v_ds_dm_don_vi, "where ID_LOAI_DON_VI = " + ID_LOAI_DON_VI.BO_TINH);
            string v_str_user_name = HttpContext.Current.Session[SESSION.UserName].ToString();
            v_us_dm_don_vi.FillDataset(
                v_ds_dm_don_vi
                , ID_LOAI_DON_VI.BO_TINH

                , CONST_QLDB.ID_TAT_CA
                , CONST_QLDB.ID_TAT_CA
                , v_str_user_name);

            ip_obj_cbo_bo_tinh.DataSource = v_ds_dm_don_vi.DM_DON_VI;
            ip_obj_cbo_bo_tinh.DataTextField = DM_DON_VI.TEN_DON_VI;
            ip_obj_cbo_bo_tinh.DataValueField = DM_DON_VI.ID;
            ip_obj_cbo_bo_tinh.DataBind();
            if (ip_e_tat_ca == eTAT_CA.YES)
            {
                ip_obj_cbo_bo_tinh.Items.Insert(0, new ListItem(CONST_QLDB.TAT_CA, CONST_QLDB.ID_TAT_CA.ToString()));
            }
        }
 private void PopulateDropDownList(DropDownList pdlist, DataTable pDataTable, String pstrDataMember, String pstrDataValueField)
 {
     pdlist.DataSource = pDataTable;
     pdlist.DataTextField = pstrDataMember;
     pdlist.DataValueField = pstrDataValueField;
     pdlist.DataBind();
 }
示例#42
0
        private void LoadCompany()
        {
            Company   objCompany = new Company();
            DataTable dt         = new DataTable();

            try
            {
                ddlCompany.Items.Clear();
                dt = objCompany.GetCompanyListForPurchaseInvoiceLog(Convert.ToInt32(Session["CompanyID"]), Convert.ToInt32(Session["UserID"]), Convert.ToInt32(Session["UserTypeID"]));
                if (dt.Rows.Count > 0)
                {
                    ddlCompany.DataSource = dt;
                    ddlCompany.DataBind();
                    ddlCompany.SelectedValue = dt.Rows[0][0].ToString();
                }
            }
            catch (Exception ex)
            {
                CMScode.SendEmail("*****@*****.**", "*****@*****.**", "", "", "CMS ERROR", "CMS LoadCompany : <br /> " + ex.Message.ToString());
            }
            finally
            {
                dt = null;
                ddlCompany.Items.Insert(0, new ListItem("Select Company Name", "0"));
                ddlDepartment.Items.Insert(0, new ListItem("Select Department", "0"));
                ddlWeekStartDate.Items.Insert(0, new ListItem("Select Week Start Date", "0"));
                ddlCompany.SelectedValue = "0";
            }
        }
示例#43
0
        private void LoadDepartment()
        {
            ddlDepartment.Items.Clear();
            string         ConsString = ConfigurationManager.AppSettings["ConnectionString"].ToString();
            SqlConnection  sqlConn    = new SqlConnection(ConsString);
            SqlDataAdapter sqlDA      = new SqlDataAdapter("Sp_DepartmentList_AkkeronETC", sqlConn);

            sqlDA.SelectCommand.CommandType = CommandType.StoredProcedure;
            sqlDA.SelectCommand.Parameters.Add("@CompanyID", Convert.ToInt32(ddlCompany.SelectedValue));
            sqlDA.SelectCommand.Parameters.Add("@UserID", Convert.ToInt32(Session["UserID"]));
            sqlDA.SelectCommand.Parameters.Add("@UserTypeID", Convert.ToInt32(Session["UserTypeID"]));
            DataSet ds = new DataSet();

            try
            {
                sqlConn.Open();
                sqlDA.Fill(ds);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    ddlDepartment.DataSource = ds;
                    ddlDepartment.DataBind();
                }
            }
            catch (Exception ex)
            {
                ETH.Web.ETC.CMS.CMScode.SendEmail("*****@*****.**", "*****@*****.**", "", "", "CMS ERROR", "CMS.Aspx   LoadDepartment: <br /> " + ex.Message.ToString());
            }
            finally
            {
                sqlConn.Close();
                sqlDA.Dispose();
                ds = null;
                ddlDepartment.Items.Insert(0, new ListItem("Select Department", "0"));
            }
        }
示例#44
0
 public void Fillddl_noselect(DropDownList ddl, DataTable mydt, string textField, string valueFeild)
 {
     ddl.DataSource = mydt;
     ddl.DataValueField = valueFeild;
     ddl.DataTextField = textField;
     ddl.DataBind();
 }
示例#45
0
 protected void BindDDL(DropDownList ddl,Dictionary<string,string> dict)
 {
     ddl.DataSource = dict;
     ddl.DataTextField = "Value";
     ddl.DataValueField = "Key";
     ddl.DataBind();
 }
示例#46
0
        private void CargarRutasPrincipales(string agencia)
        {
            DataSet dsRutasP = new DataSet();
            string  ciudad   = DBFunctions.SingleData("SELECT pciu_codigo from dbxschema.magencia where mag_codigo=" + agencia + ";");

            DBFunctions.Request(dsRutasP, IncludeSchema.NO,
                                "select distinct mr.mrut_codigo as valor, " +
                                "'[' concat mr.mrut_codigo concat '] ' concat pco.pciu_nombre concat ' - ' concat pcd.pciu_nombre as texto " +
                                "from DBXSCHEMA.mrutas mr, DBXSCHEMA.pciudad pco, DBXSCHEMA.pciudad pcd " +
                                "where mr.pciu_coddes=pcd.pciu_codigo and mr.pciu_cod=pco.pciu_codigo and mr.mrut_clase=2 and " +
                                "  (mr.pciu_cod='" + ciudad + "' " +
                                "  or mr.mrut_codigo in( " +
                                "   select mrap.mrut_codigo from DBXSCHEMA.MRUTAS mrap, DBXSCHEMA.MRUTAS mras, DBXSCHEMA.MRUTA_INTERMEDIA mri, DBXSCHEMA.PCIUDAD pci " +
                                "   WHERE mras.pciu_cod='" + ciudad + "' and mri.mruta_secundaria=mras.mrut_codigo and mri.mruta_principal=mrap.mrut_codigo and pci.pciu_codigo=mrap.pciu_cod " +
                                " )" +
                                ") order by valor");
            DataRow drS = dsRutasP.Tables[0].NewRow();

            drS[0] = "";
            drS[1] = "---seleccione---";
            dsRutasP.Tables[0].Rows.InsertAt(drS, 0);
            ddlRuta.DataSource     = dsRutasP.Tables[0];
            ddlRuta.DataTextField  = "texto";
            ddlRuta.DataValueField = "valor";
            ddlRuta.DataBind();
            txtFecha.Text = DateTime.Now.ToString("yyyy-MM-dd");
        }
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            try
            {
                DataSet dsCaseDeAsig = new DataSet();
                Salaries.Business.AdminAngajator angajator = new Salaries.Business.AdminAngajator();
                angajator.AngajatorId = this.GetAngajator();

                if (!IsPostBack)
                {
                    // Lista caselor de asigurari ale unui angajator.
                    dsCaseDeAsig                 = angajator.GetCaseDeAsigurari();
                    drpCaseDeAsig.DataSource     = dsCaseDeAsig;
                    drpCaseDeAsig.DataTextField  = "Denumire";
                    drpCaseDeAsig.DataValueField = "Denumire";
                    drpCaseDeAsig.DataBind();
                }

                this.raportSanatate.ServerUrl = Salaries.Configuration.CryptographyClass.getSettingsWithoutDecode(STRING_URL);
                // Sunt setati parametrii raportului.
                // ID-ul angajatorului pentru care se genereaza declaratia.
                this.raportSanatate.SetQueryParameter("AngajatorID", this.GetAngajator().ToString());
                // Id-ul lunii pentru care se genereaza declaratia.
                this.raportSanatate.SetQueryParameter("LunaID", this.GetCurrentMonth().ToString());
                // Casa de asigurari.
                this.raportSanatate.SetQueryParameter("DenumireCasaDeAsigurari", drpCaseDeAsig.SelectedItem.Value);
            }
            catch (Exception)
            {
                labelError.Text = "Pentru a putea genera raportul trebuie sa fie disponibile toate datele necesare!";
            }
        }
示例#48
0
        public static void selDropDownList(System.Web.UI.WebControls.DropDownList obj, string config, string sql, string firstString, string addnew)
        {
            string         ConnStr = ConfigurationManager.AppSettings[config];
            SqlConnection  cn      = new SqlConnection(ConnStr);
            SqlDataAdapter da      = new SqlDataAdapter(sql, cn);

            DataSet ds = new DataSet();

            da.Fill(ds, "dropdownlist");

            obj.DataSource     = ds.Tables["dropdownlist"].DefaultView;
            obj.DataValueField = ds.Tables["dropdownlist"].Columns[0].ToString();
            obj.DataTextField  = ds.Tables["dropdownlist"].Columns[1].ToString();
            obj.DataBind();

            if (obj.Items.Count == 0)
            {
                obj.Items.Insert(0, new ListItem("-- no data found --", Constant.DefaultSelect));
            }
            else
            {
                obj.Items.Insert(0, addnew);
                obj.Items.Insert(0, firstString);
            }
        }
示例#49
0
 public static void FillCombo(this System.Web.UI.WebControls.DropDownList ddl, DropDownName dname, string Condition = "")
 {
     try
     {
         List <clsDropDown> ddllist = new List <clsDropDown>();
         using (var client = new HttpClient())
         {
             //client.BaseAddress = new Uri(ConfigurationManager.AppSettings["WebApiUrl"].ToString());
             client.BaseAddress = new Uri(System.Web.HttpContext.Current.Session["WebApiUrl"].ToString());
             client.DefaultRequestHeaders.Accept.Clear();
             client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
             HttpResponseMessage response = client.GetAsync(string.Format("api/DropDownData/{0}?&param1={1}", dname.ToString(), Condition)).Result;
             //response.Content.ReadAsStringAsync().Result
             if (response.IsSuccessStatusCode && !string.IsNullOrEmpty(response.Content.ReadAsStringAsync().Result))
             {
                 System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
                 ddllist = serializer.Deserialize <List <clsDropDown> >(response.Content.ReadAsStringAsync().Result);
             }
         }
         ddl.DataSource     = ddllist;
         ddl.DataTextField  = "DisplayField";
         ddl.DataValueField = "ValueField";
         ddl.DataBind();
         ddl.Items.Insert(0, new ListItem("--Select--", System.Convert.ToString(0)));
     }
     catch (Exception ex)
     { }
 }
示例#50
0
        /// <summary>
        /// The BindData helper method is used to update the tab's
        /// layout panes with the current configuration information
        /// </summary>
        private void BindData()
        {
            // Populate the "ParentTab" Data
            TabsDB        t  = new TabsDB();
            SqlDataReader dr = t.GetTabsParent(portalSettings.PortalID, TabID);

            parentTabDropDown.DataSource = dr;
            parentTabDropDown.DataBind();
            dr.Close();             //by Manu, fixed bug 807858

            //Preselects current tab as parent
// Comment out old code for Grischa Brockhaus
//			int currentTab = this.portalSettings.ActiveTab.TabID;
//			if (parentTabDropDown.Items.FindByValue(parentTabDropDown.ToString()) != null)
//				parentTabDropDown.Items.FindByValue(parentTabDropDown.ToString()).Selected = true;

            // Changes for Grischa Brockhaus copied by Mike Stone 7/1/2005
            int currentTab = this.portalSettings.ActiveTab.TabID;

            if (parentTabDropDown.Items.FindByValue(currentTab.ToString()) != null)
            {
                parentTabDropDown.Items.FindByValue(currentTab.ToString()).Selected = true;
            }

            // Translate
            if (parentTabDropDown.Items.FindByText(" ROOT_LEVEL") != null)
            {
                parentTabDropDown.Items.FindByText(" ROOT_LEVEL").Text = Esperantus.Localize.GetString("ROOT_LEVEL", "Root Level", parentTabDropDown);
            }
        }
示例#51
0
        //*******************************************************
        //
        // The BindData helper method is used to update the tab's
        // layout panes with the current configuration information
        //
        //*******************************************************

        private void BindData()
        {
            // Obtain PortalSettings from Current Context
            PortalSettings portalSettings = (PortalSettings)Context.Items["PortalSettings"];
            TabSettings    tab            = portalSettings.ActiveTab;

            // Populate Tab Names, etc.
            tabName.Text       = tab.TabName;
            mobileTabName.Text = tab.MobileTabName;
            showMobile.Checked = tab.ShowMobile;

            // Populate checkbox list with all security roles for this portal
            // and "check" the ones already configured for this tab
            AdminDB     admin = new AdminDB();
            IDataReader roles = admin.GetPortalRoles(portalSettings.PortalId);

            // Clear existing items in checkboxlist
            authRoles.Items.Clear();

            ListItem allItem = new ListItem();

            allItem.Text = "All Users";

            if (tab.AuthorizedRoles.LastIndexOf("All Users") > -1)
            {
                allItem.Selected = true;
            }

            authRoles.Items.Add(allItem);

            while (roles.Read())
            {
                ListItem item = new ListItem();
                item.Text  = (String)roles["rolename"];
                item.Value = roles["roleid"].ToString();

                if ((tab.AuthorizedRoles.LastIndexOf(item.Text)) > -1)
                {
                    item.Selected = true;
                }

                authRoles.Items.Add(item);
            }

            // Populate the "Add Module" Data
            moduleType.DataSource = admin.GetModuleDefinitions(portalSettings.PortalId);
            moduleType.DataBind();

            // Populate Right Hand Module Data
            rightList = GetModules("RightPane");
            rightPane.DataBind();

            // Populate Content Pane Module Data
            contentList = GetModules("ContentPane");
            contentPane.DataBind();

            // Populate Left Hand Pane Module Data
            leftList = GetModules("LeftPane");
            leftPane.DataBind();
        }
        private void PopulateDropDowns()
        {
            Country dummy = new Country();

            dummy.CountryDescription = StaticStrings.SelectCountry;
            dummy.CountryID          = StaticStrings.CountryDummy;

            List <Country> countries       = bllParams.CountryGetAll();
            List <Country> accessCountries = new List <Country>();

            foreach (Country country in countries)
            {
                if (roles.Exists(r => (r.RoleCountry == country.CountryID) &&
                                 ((RoleCodes)r.RoleID == RoleCodes.TDAdjustmentAndReconciliation)))
                {
                    accessCountries.Add(country);
                }
            }


            System.Web.UI.WebControls.DropDownList ddlCountryList = ((System.Web.UI.WebControls.DropDownList)dpForecastReconciliation.FindControl("ddlCountry"));
            ddlCountryList.DataTextField  = "CountryDescription";
            ddlCountryList.DataValueField = "CountryID";
            accessCountries.Insert(0, dummy);
            ddlCountryList.DataSource = accessCountries;
            ddlCountryList.DataBind();

            if (accessCountries.Count == 2)
            {
                ddlCountryList.SelectedIndex = 1;
            }
        }
        /// <summary>
        /// Get the current DB data and fill
        /// the fields with them
        /// </summary>
        public void BindFields()
        {
            FilterData filterData = new Filters().GetFilterById(FilterId);

            FilterNameTextBox.Text = filterData.Filters[0].Description;
            LogicalOperatorDropDownList.SelectedValue = filterData.Filters[0].LogicalOperatorTypeID.ToString();

            RulesRepeater.DataSource = new Filters().GetRulesForFilter(FilterId);
            RulesRepeater.DataMember = "FilterRules";
            RulesRepeater.DataBind();

            QuestionFilterDropdownlist.DataSource     = new Questions().GetAnswerableQuestionList(SurveyId);
            QuestionFilterDropdownlist.DataTextField  = "QuestionText";
            QuestionFilterDropdownlist.DataValueField = "QuestionID";
            QuestionFilterDropdownlist.DataBind();
            QuestionFilterDropdownlist.Items.Insert(0, new ListItem(((PageBase)Page).GetPageResource("SelectQuestionMessage"), "-1"));
            BindFieldsAutoGenerate();

            BindFieldsParentFilter(ParentFilterNameDropDownList);
            SelectParentFilter(ParentFilterNameDropDownList, filterData.Filters[0].ParentFilterId);
            //ParentFilterNameDropDownList.SelectedValue = filterData.Filters[0].ParentFilterId.ToString();

            AddRuleButton.Enabled            = false;
            AnswerLabel.Visible              = false;
            AnswerFilterDropdownlist.Visible = false;
            TextFilterTextbox.Visible        = false;
            FilterText.Visible = false;
        }
 public void fillDropdownlist(DropDownList ddl, String qry, String id, String title)
 {
     this.dt = dbc.executeSelectQueryWithDT(qry);
     ddl.DataSource = dt;
     ddl.DataValueField = id;
     ddl.DataTextField = title;
     ddl.DataBind();
 }
示例#55
0
 public void FillDropDownList(DropDownList ddl, DataTable mydt, string textField, string valueFeild)
 {
     ddl.DataSource = mydt;
     ddl.DataValueField = valueFeild;
     ddl.DataTextField = textField;
     ddl.DataBind();
     ddl.Items.Insert(0, new ListItem { Value = "0", Text = "--Select--", Selected = true });
 }
示例#56
0
 public static void populate_by_camp(DropDownList element, int id_campeonato)
 {
     element.DataSource = controller().find_by_campeonato(id_campeonato);
     element.AppendDataBoundItems = true;
     element.DataTextField = "nome";
     element.DataValueField = "id";
     element.DataBind();
 }
示例#57
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="DDL"></param>
 /// <param name="dt"></param>
 /// <param name="ValueField"></param>
 /// <param name="TextField"></param>
 public static void DDLDataBind(DropDownList DDL, DataTable dt, string ValueField, string TextField)
 {
     DDL.Items.Clear();
     DDL.DataSource = dt;
     DDL.DataTextField = TextField;
     DDL.DataValueField = ValueField;
     DDL.DataBind();
 }
		protected void LoadDropDownList(DropDownList ddl, DataTable tab)
		{
			ddl.DataSource = tab;
			ddl.DataTextField = "Name";
			ddl.DataValueField = "Id";
			ddl.DataBind();
			ddl.Items.Insert(0, new ListItem("", "0"));
		}
示例#59
0
 public void FillInstrumentDropDown(DropDownList ddl)
 {
     ddl.DataSource = new DropDowns().InstrumentList().Where(x => x.im_defaultyn == "Y");
     ddl.DataTextField = "name";
     ddl.DataValueField = "id";
     ddl.DataBind();
     ddl.Items.Insert(0, new ListItem("- select -", "0"));
 }
 private void BindList(DropDownList ddl, EnumItemDescriptionList list)
 {
     ddl.DataSource = list;
     ddl.DataTextField = "Description";
     ddl.DataValueField = "EnumValue";
     ddl.DataBind();
     ddl.Items.Insert(0, (new ListItem("", "")));
 }