Example #1
0
        public static void fillDropDownItems(System.Web.UI.WebControls.DropDownList ddl,UserGroup _userGroupObj)
        {
            try
            {
                //if (Branch.dropDownItems.Count < 1)
                //{
                //    new BranchSelectDataByUser().getBranchDropDownItemsByUser(-1);
                //}

                UserGroup _u = new UserGroup();
                _u = _userGroupObj;
                new UserGroupSelect(_u).UserGroupDropDownList(_u._dropDownList);

                ddl.DataSource = _u._dropDownList;
                ddl.DataTextField = "Name";
                ddl.DataValueField = "Value";
                ddl.DataBind();

            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                ddl = null;
            }
        }
Example #2
0
 protected void binddrop(string message, System.Web.UI.WebControls.DropDownList drop)
 {
     drop.DataSource = comtypeBll.getType(message);
     drop.DataTextField = "tname";
     drop.DataValueField = "id";
     drop.DataBind();
 }
        public void fillListedUnitGroups(System.Web.UI.WebControls.ListBox lstbx)
        {
            UnitAndUnitGroupSelect _unitNGroup = new UnitAndUnitGroupSelect();
            UserGroup ug = new UserGroup();
            try
            {

                _unitNGroup.UserID = this._userID;
                _unitNGroup.ComID = this._comID;
                _unitNGroup.LoadListedUnitGroups(ug._dropDownList);

                lstbx.DataSource = ug._dropDownList;
                lstbx.DataTextField = "Name";
                lstbx.DataValueField = "Value";
                lstbx.DataBind();
            }
            catch (Exception ex)
            {
                ex.Message.ToString();
            }
            finally
            {
                _unitNGroup = null;
                ug = null;

            }
        }
Example #4
0
 public static void comboRellenar(System.Web.UI.WebControls.DropDownList combo, string textoSql, string cadenaConexion, string mensajeInicial)
 {
     combo.Items.Clear();
     if (cadenaConexion == "")
     {
         cadenaConexion = ctes.conStringAdoGeneral;
     }
     dbClass pp = new dbClass(cadenaConexion);
     MySql.Data.MySqlClient.MySqlDataReader reg;
     // 'SqlClient.SqlDataReader
     DataTable esquema;
     reg = pp.sql(textoSql);
     esquema = reg.GetSchemaTable();
     combo.DataSource = reg; //myDataReader
     combo.DataTextField = sf.cadena(esquema.Rows[1].ItemArray[0]);
     combo.DataValueField = sf.cadena(esquema.Rows[0].ItemArray[0]);
     //.Columns(1).ColumnName.ToString '.Item(0).ColumnName.ToString;
     //'"idlicencias" 'myDataReader.Fields(0).Name;
     combo.DataBind();
     //   mensajeInicial = "<Elija una opcion>";
     if (mensajeInicial != "")
     {
         ListItem per = new ListItem();
         per.Value = sf.cadena(0);
         per.Text = mensajeInicial;
         combo.Items.Insert(0, per);
     }
     pp.Dispose();
 }
 public void GetDropDownListBind(System.Web.UI.WebControls.DropDownList ddl, string strText, string strValue, DataTable db)
 {
     ddl.DataSource = GetRepeatedDadatable(db, strValue);
     ddl.DataTextField = strText;
     ddl.DataValueField = strValue;
     ddl.DataBind();
 }
 //根据数据,生成下拉列表
 public void GetDropDownListBind(System.Web.UI.WebControls.DropDownList ddl, string strText, string strValue, string strTable, string strWhere)
 {
     ddl.DataSource = GetList(strTable, strWhere);
     ddl.DataTextField = strText;
     ddl.DataValueField = strValue;
     ddl.DataBind();
 }
        /// <summary>
        /// load dropdownlist 
        /// </summary>
        /// <param name="ddl">System.Web.UI.WebControls.DropDownList ddl</param>
        public static void fillListBoxItems(System.Web.UI.WebControls.ListBox _lst, UnitType _unitype)
        {
            try
            {

                UnitType _c = new UnitType();
                _c = _unitype;
                new UnitTypeSelect(_c).UnitTypeListBox(_c._dropDownList);

                _lst.DataSource = _c._dropDownList;
                _lst.DataTextField = "Name";
                _lst.DataValueField = "Value";
                _lst.DataBind();

            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _lst = null;
                _unitype = null;
            }
        }
        public static void fillListBox(System.Web.UI.WebControls.ListBox _lst, int _comID)
        {
            try
            {

                Units _unit=new Units();

                UnitInfoSelect _unitSelect = new UnitInfoSelect();
                _unitSelect.ComID = _comID;
                _unitSelect.UnitListBoxItems(_unit._ListItems);

                _lst.DataSource = _unit._ListItems;
                _lst.DataTextField = "Name";
                _lst.DataValueField = "Value";
                _lst.DataBind();

            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _lst = null;
            }
        }
        /// <summary>
        /// load dropdownlist 
        /// </summary>
        /// <param name="ddl">System.Web.UI.WebControls.DropDownList ddl</param>
        public static void fillDropDownItems(System.Web.UI.WebControls.DropDownList ddl)
        {
            try
                {
                    //if (Branch.dropDownItems.Count < 1)
                    //{
                    //    new BranchSelectDataByUser().getBranchDropDownItemsByUser(-1);
                    //}

                    Company _c = new Company();
                    new CompanySelect().CompanyDropDownList(_c._dropDownList);

                    ddl.DataSource = _c._dropDownList;
                    ddl.DataTextField = "Name";
                    ddl.DataValueField = "Value";
                    ddl.DataBind();

                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    ddl = null;
                }
        }
Example #10
0
    public static void Paggination(System.Web.UI.WebControls.Repeater rptPager, int recordCount, int currentPage, int PageSize)
    {
        double dblPageCount = (double)((decimal)recordCount / decimal.Parse(PageSize.ToString()));
        int pageCount = (int)Math.Ceiling(dblPageCount);
        List<ListItem> pages = new List<ListItem>();
        if (pageCount > 0)
        {
            pages.Add(new ListItem("First", "1", currentPage > 1));
            pages.Add(new ListItem("Previous", (currentPage - 1).ToString(), currentPage > 1));

            var page_show = 6;
            var both_side_page_show = page_show / 2;

            var show_bellow_limit = currentPage - both_side_page_show;
            var show_top_side_limit = pageCount - both_side_page_show;

            var show_bellow_lower_limit = currentPage - both_side_page_show;
            var show_bellow_top_upper_limit=0;
            if (show_bellow_lower_limit <= 0)
            {
                show_bellow_lower_limit = 1;
                show_bellow_top_upper_limit = show_bellow_lower_limit + both_side_page_show;
            }
            else
            {
                show_bellow_lower_limit = currentPage;
                 show_bellow_top_upper_limit = currentPage + both_side_page_show;
            }

            var show_top_upper_limit = pageCount - both_side_page_show;
            var show_top_lower_limit = show_top_upper_limit - both_side_page_show;

            var do_no = 0;
            for (int i = 1; i <= pageCount; i++)
            {

                if (
                    ((i >= show_bellow_lower_limit) && (i <= show_bellow_top_upper_limit))
                    ||
                    ((i <= show_top_upper_limit) && (i >= show_top_lower_limit))
                    )
                {

                    pages.Add(new ListItem(i.ToString(), i.ToString(), i != currentPage));
                    if ((do_no == 0) && (i >= show_bellow_top_upper_limit))
                    {
                        pages.Add(new ListItem("...", i.ToString(), i != currentPage));
                        do_no++;
                    }

                }
            }
            pages.Add(new ListItem("Next", (currentPage + 1).ToString(), currentPage < pageCount));
            pages.Add(new ListItem("Last", pageCount.ToString(), currentPage < pageCount));
        }
        rptPager.DataSource = pages;
        rptPager.DataBind();
    }
 public void LogTypeBind(System.Web.UI.WebControls.DropDownList ddlControl)
 {
     string str = "select Distinct LogType from Sys_OperateLog";
     ddlControl.DataSource = DbHelperSQL.DQuery(str);
     ddlControl.DataTextField = "LogType";
     ddlControl.DataValueField = "LogType";
     ddlControl.DataBind();
     ddlControl.Items.Insert(0, new System.Web.UI.WebControls.ListItem("请选择操作类型", ""));
 }
 //绑定已经存在数据库中的表(特定用在日志中的操作表)
 public void GetOperatTableBind(System.Web.UI.WebControls.DropDownList ddlControl, string strWhere)
 {
     string str = "select Distinct OperateTable from Sys_OperateLog where " + strWhere;
     ddlControl.DataSource = DbHelperSQL.DQuery(str);
     ddlControl.DataTextField = "OperateTable";
     ddlControl.DataValueField = "OperateTable";
     ddlControl.DataBind();
     ddlControl.Items.Insert(0,new System.Web.UI.WebControls.ListItem("请选择操作表", ""));
 }
Example #13
0
        public static void CarregarCombo(string v_sAssembly, long v_iID, System.Web.UI.WebControls.DropDownList v_oDDL)
        {
            Type m_oType = Type.GetType(v_sAssembly);
            object m_oObjeto = System.Activator.CreateInstance(m_oType);

            v_oDDL.DataSource = ((Dor.Base.Base)m_oObjeto).Listar(v_iID);
            v_oDDL.DataValueField = ((Dor.Base.Base)m_oObjeto).GetAtributo("Codigo", "Html").ToString();
            v_oDDL.DataTextField = ((Dor.Base.Base)m_oObjeto).GetAtributo("Nome", "Html").ToString();
            v_oDDL.DataBind();
        }
Example #14
0
 //BindSysResCheckBoxList(cblProblems,"res_fileproblems","name","name")
 public void BindSysResCheckBoxList(System.Web.UI.WebControls.CheckBoxList cbl,string tablename,string fieldv,string fieldt)
 {
     CommonDAL commonDAL = new CommonDAL(conn);
     string sql = "select * from " + tablename + " ";
     DataSet ds = commonDAL.GetDS(sql);
     cbl.DataSource = ds;
     cbl.DataTextField = fieldt;
     cbl.DataValueField = fieldv;
     cbl.DataBind();
 }
 public static void LoadQuiz_FillInTheBlanksDetailsPage(System.Web.UI.WebControls.GridView gv, System.Web.UI.WebControls.Repeater rptPager, int pageIndex, DropDownList ddlPageSize)
 {
     int recordCount=0;
     int PageSize =  int.Parse(ddlPageSize.SelectedValue);
     SqlQuiz_FillInTheBlanksDetailsProvider sqlQuiz_FillInTheBlanksDetailsProvider = new SqlQuiz_FillInTheBlanksDetailsProvider();
     DataSet ds =  sqlQuiz_FillInTheBlanksDetailsProvider.GetQuiz_FillInTheBlanksDetailsPageWise(pageIndex, PageSize, out recordCount);
     gv.DataSource = ds;
     gv.DataBind();
      quiz_FillInTheBlanksDetailssPaggination(rptPager,recordCount, pageIndex, PageSize);
 }
Example #16
0
 public static void LoadHR_BenifitPackagePage(System.Web.UI.WebControls.GridView gv, System.Web.UI.WebControls.Repeater rptPager, int pageIndex, DropDownList ddlPageSize)
 {
     int recordCount=0;
     int PageSize =  int.Parse(ddlPageSize.SelectedValue);
     SqlHR_BenifitPackageProvider sqlHR_BenifitPackageProvider = new SqlHR_BenifitPackageProvider();
     DataSet ds =  sqlHR_BenifitPackageProvider.GetHR_BenifitPackagePageWise(pageIndex, PageSize, out recordCount);
     gv.DataSource = ds;
     gv.DataBind();
      hR_BenifitPackagesPaggination(rptPager,recordCount, pageIndex, PageSize);
 }
Example #17
0
    public static void GetAllSTD_FeesList_NotPaid(System.Web.UI.WebControls.GridView gv, System.Web.UI.WebControls.Repeater rptPager, int pageIndex, DropDownList ddlPageSize)
    {
        int recordCount = 0;
        int PageSize = int.Parse(ddlPageSize.SelectedValue);
        SqlSTD_FeesProvider sqlSTD_ProgramProvider = new SqlSTD_FeesProvider();
        DataSet ds = sqlSTD_ProgramProvider.GetAllSTD_FeesList_NotPaid(pageIndex, PageSize, out recordCount);
        gv.DataSource = processDataSet(ds);
        gv.DataBind();

        COMN_CommonManager.Paggination(rptPager, recordCount, pageIndex, PageSize);
    }
Example #18
0
 public static void LoadSTD_ProgramPage(System.Web.UI.WebControls.GridView gv, System.Web.UI.WebControls.Repeater rptPager, int pageIndex, DropDownList ddlPageSize)
 {
     int recordCount=0;
     int PageSize =  int.Parse(ddlPageSize.SelectedValue);
     SqlSTD_ProgramProvider sqlSTD_ProgramProvider = new SqlSTD_ProgramProvider();
     DataSet ds =  sqlSTD_ProgramProvider.GetSTD_ProgramPageWise(pageIndex, PageSize, out recordCount);
     gv.DataSource = ds;
     gv.DataBind();
     COMN_CommonManager common= new COMN_CommonManager();
     COMN_CommonManager.Paggination(rptPager,recordCount, pageIndex, PageSize);
 }
Example #19
0
 public void BindSysResDDL(System.Web.UI.WebControls.DropDownList ddl, string tablename, string cond,string orderby, bool withblankitem)
 {
     SysResDAL sysResDAL = new SysResDAL(conn);
     DataSet ds = sysResDAL.GetSysResDS(tablename, cond, orderby);
     ddl.DataSource = ds;
     ddl.DataTextField = "name";
     ddl.DataValueField = "code";
     ddl.DataBind();
     if (withblankitem){
         ddl.Items.Insert(0,new System.Web.UI.WebControls.ListItem("", ""));
     }
 }
        /// <summary>
        /// CheckBoxListBind�
        /// </summary>
        /// <param name="chklControl">CheckBoxList�ؼ�</param>
        /// <param name="strTableName">����</param>
        /// <param name="strText">��ʾ���ֶ�</param>
        /// <param name="strValue">ֵ�ֶ�</param>
        /// <param name="strWhere">��ѯ����</param>
        public static void CheckBoxListBind(System.Web.UI.WebControls.CheckBoxList chklControl, string strTableName, string strText, string strValue, string strWhere)
        {
            string strSql = "SELECT * FROM " + strTableName + " Where " + strWhere;
            DataSet dstTemp = new DataSet();

            dstTemp = DbHelperSQL.Query(strSql);

            chklControl.DataSource = dstTemp.Tables[0];
            chklControl.DataTextField = strText;
            chklControl.DataValueField = strValue;
            chklControl.DataBind();
        }
Example #21
0
 protected void FillDDL(ref System.Web.UI.WebControls.DropDownList ddl, System.Data.SqlClient.SqlCommand sql, string textField, string valueField)
 {
     try
     {
         ddl.DataSource = getData(sql);
         ddl.DataTextField = textField;
         ddl.DataValueField = valueField;
         ddl.DataBind();
     }
     catch (System.Exception ex)
     {
         conCloseNo();
     }
 }
Example #22
0
    public static void selDropDownList(System.Web.UI.WebControls.DropDownList obj, string config, string sql, bool blCOne)
    {
        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();
    }
 public void FillListBox(System.Web.UI.WebControls.ListBox lb, TTSHWCFReference.DropDownName listname, string Condition = "")
 {
     TTSHWCFServiceClient cl = new TTSHWCFServiceClient();
     try
     {
         List<TTSHWCFReference.clsDropDown> listbox = cl.GetDropDownData(listname, ddlAuditModules.SelectedValue, "", "", "", "").ToList();
         lb.DataSource = listbox;
         lb.DataTextField = "DisplayField";
         lb.DataValueField = "ValueField";
         lb.DataBind();
         //lb.Items.Insert(0, new ListItem("--Select--", "-1"));
     }
     catch
     { }
 }
Example #24
0
        public void GetDocCodeByType(string Dept_ID, System.Web.UI.WebControls.DropDownList drgList)
        {
            Database db = DatabaseFactory.CreateDatabase(DocConnStr);
            string strSql = " SELECT A.L_ID,A.L_NAME FROM OA_DOC_SENDLOGO A WHERE A.MAINDEPT='" + Dept_ID + "' OR A.ISALL='1' AND CMP_CODE='" + System.Web.HttpContext.Current.Session["EPORTID"].ToString() + "'";

            DbCommand cmd = db.GetSqlStringCommand(strSql);
            DataView dv = db.ExecuteDataView(cmd);

            drgList.DataSource = dv;
            drgList.DataTextField = "L_NAME";
            drgList.DataValueField = "L_ID";
            drgList.DataBind();
            drgList.Items.Insert(0, "--请选择--");
            drgList.SelectedIndex = 0;
        }
Example #25
0
        public void GetDocCodeByType(string Type_ID, System.Web.UI.WebControls.DropDownList drgList)
        {
            Database db = DatabaseFactory.CreateDatabase(DocConnStr);
            string strSql = (Type_ID == "4" || Type_ID == "8") ? " SELECT B_ID,B_CONTENT FROM OA_DOC_BASECODE WHERE B_TYPE='" + Type_ID + "'" : " SELECT B_ID,B_CONTENT FROM OA_DOC_BASECODE WHERE B_TYPE='" + Type_ID + "' AND CMP_CODE='"+System.Web.HttpContext.Current.Session["EPORTID"].ToString()+"'";

            DbCommand cmd = db.GetSqlStringCommand(strSql);
            DataView dv = db.ExecuteDataView(cmd);

            drgList.DataSource = dv;
            drgList.DataTextField = "B_CONTENT";
            drgList.DataValueField = "B_ID";
            drgList.DataBind();
            drgList.Items.Insert(0, "--请选择--");
            drgList.SelectedIndex = 0;
        }
        public static void BindUnit(System.Web.UI.WebControls.DropDownList ddl, XBase.Common.UserInfoUtil userinfo)
        {
            string sqlstr = "select ID,CodeName from officedba.CodeUnitType where UsedStatus=1 and [email protected]";

            SqlParameter[] param = {
                                     new SqlParameter("@CompanyCD",SqlDbType.VarChar)
                                 };
            param[0].Value = userinfo.CompanyCD;
            DataSet ds = SqlHelper.ExecuteSqlX(sqlstr, param);
            ddl.DataTextField = "CodeName";
            ddl.DataValueField = "ID";
            ddl.DataSource = ds;
            ddl.DataBind();
            ddl.DataSource = null;
            ddl.Items.Insert(0, new System.Web.UI.WebControls.ListItem("---请选择单位---", "0"));  
        }
Example #27
0
        public static void CarregarDropDownList(System.Web.UI.WebControls.DropDownList ddl, System.Data.DataTable table, string valor, string texto)
        {
            ddl.Items.Clear();
            ddl.Items.Add(new ListItem("--Selecione--", "0"));
            foreach (System.Data.DataRow row in table.Rows)
            {
                ddl.Items.Add(new ListItem(row[texto].ToString(), row[valor].ToString()));
            }

            //ddl.DataSource = table;
            //ddl.Items.Clear();
            //ddl.DataTextField = texto;
            //ddl.DataValueField = valor;
            //ddl.Items.Add(new ListItem("--Selecione--", "0"));
            ddl.DataBind();
            ddl.SelectedIndex = -1;
        }
Example #28
0
 public static void hR_SalaryIncrementsPaggination(System.Web.UI.WebControls.Repeater rptPager, int recordCount, int currentPage, int PageSize)
 {
     double dblPageCount = (double)((decimal)recordCount / decimal.Parse(PageSize.ToString()));
     int pageCount = (int)Math.Ceiling(dblPageCount);
     List<ListItem> pages = new List<ListItem>();
     if (pageCount > 0)
     {
      		pages.Add(new ListItem("First", "1", currentPage > 1));
     for (int i = 1; i <= pageCount; i++)
     {
      pages.Add(new ListItem(i.ToString(), i.ToString(), i != currentPage));
     }
     pages.Add(new ListItem("Last", pageCount.ToString(), currentPage < pageCount));
     }
     rptPager.DataSource = pages;
     rptPager.DataBind();
 }
        /// <summary>
        /// Fills the specified gridview with a page of data.
        /// </summary>
        /// <param name="gv">The gridview.</param>
        /// <param name="list">The single page of data.</param>
        /// <param name="count">The total count (to work out number of pages).</param>
        /// <param name="pageSize">Size of the page.</param>
        public static void Fill(System.Web.UI.WebControls.GridView gv, IList<object> list, int count, int pageSize)
        {
            //create an ObjectDateSource object programmatically
            ObjectDataSource ods = new ObjectDataSource();
            ods.ID = "ods" + gv.ID;           

            ods.EnablePaging = gv.AllowPaging;
            ods.TypeName = "ObjectAdaptor"; //can be a common base class
            ods.SelectMethod = "Select";
            ods.SelectCountMethod = "Count";
            ods.StartRowIndexParameterName = "startRowIndex";
            ods.MaximumRowsParameterName = "maximumRows";
            ods.EnableViewState = false;
            //when creating, inject the data into the table adaptor
            ods.ObjectCreating += delegate(object sender, ObjectDataSourceEventArgs e)
            { e.ObjectInstance = new ObjectAdaptor(list, count); };
            ods.DataBind();

            gv.PageSize = pageSize;
            gv.DataSource = ods;
            gv.DataBind();
        }
        /// <summary>
        /// load dropdownlist 
        /// </summary>
        /// <param name="ddl">System.Web.UI.WebControls.DropDownList ddl</param>
        public static void fillDropDownItems(System.Web.UI.WebControls.DropDownList ddl, UnitType _unitype)
        {
            try
            {
                UnitType _c = new UnitType();
                _c = _unitype;
                new UnitTypeSelect(_c).UnitTypeDropDownList(_c._dropDownList);

                ddl.DataSource = _c._dropDownList;
                ddl.DataTextField = "Name";
                ddl.DataValueField = "Value";
                ddl.DataBind();

            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                ddl = null;
            }
        }