当前位置: 首页>>代码示例>>C#>>正文


C# DropDownList.DataBind方法代码示例

本文整理汇总了C#中DropDownList.DataBind方法的典型用法代码示例。如果您正苦于以下问题:C# DropDownList.DataBind方法的具体用法?C# DropDownList.DataBind怎么用?C# DropDownList.DataBind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DropDownList的用法示例。


在下文中一共展示了DropDownList.DataBind方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Bind

 /// <summary>
 /// Metodo para llenar un DropdownList
 /// </summary>
 /// <param name="dropDownList"></param>
 /// <param name="data"></param>
 public void Bind(DropDownList dropDownList, IList data, string value, string text)
 {
     dropDownList.DataSource = data;
     dropDownList.DataValueField = value;
     dropDownList.DataTextField = text;
     dropDownList.DataBind();
 }
开发者ID:helbert959,项目名称:Sistema_Control_Pedidos_net,代码行数:12,代码来源:UIPage.cs

示例2: cargar_combo

 private void cargar_combo(DropDownList combo,String textField, String valueField)
 {
     combo.DataTextField = textField;
     combo.DataValueField = valueField;
     combo.DataBind();
     combo.SelectedIndex = 0;
 }
开发者ID:J3l1z4,项目名称:PasantiasSEU,代码行数:7,代码来源:alumno.aspx.cs

示例3: BindDDL

    /// <summary>
    /// 绑定下拉框 \
    /// eg: string strSql = "select * from myTableName ";
    ///     MyHelper.BindDDL(ddl_ClassBelong, strSql, "classname", "idx", null);
    /// </summary>
    /// <param name="myDDL">DropDownList对象</param>
    /// <param name="strSql">strSql语句</param>
    /// <param name="textField">textField</param>
    /// <param name="valueField">valueField</param>
    /// <param name="isSelected">isSelected 如果 null,将显示"请选择"</param>
    public static void BindDDL(DropDownList myDDL, string strSql, string textField, string valueField, string SelectedValue)
    {
        //string strSql = "select * from [class] where isshow = 'YES' order by classname ";
        DataSet ds = SqlHelper.ExecuteDataset(strSql);
        myDDL.DataSource = ds.Tables[0];
        myDDL.DataTextField = textField;
        myDDL.DataValueField = valueField;
        myDDL.DataBind();
        if (string.IsNullOrEmpty(SelectedValue))
        {
            myDDL.Items.Insert(0, "请选择");
        }
        else
        {
            for (int i = 0; i < myDDL.Items.Count; i++)
            {
                if (myDDL.Items[i].Text == SelectedValue)
                {
                    myDDL.Items[i].Selected = true;
                    break;
                }
            }
        }

    }
开发者ID:SunnyRan,项目名称:MonitoringSystem,代码行数:35,代码来源:MyHelper.cs

示例4: BindIndustry

 public static void BindIndustry(DropDownList industryDropDownList)
 {
     industryDropDownList.DataValueField = "CategoryID";
     industryDropDownList.DataTextField = "CategoryName";
     industryDropDownList.DataSource = BindIndusty(HttpContext.Current.Session["LCID"].ToString());
     industryDropDownList.DataBind();
 }
开发者ID:haithemaraissia,项目名称:Export,代码行数:7,代码来源:Utility.cs

示例5: LlenarDdlNS

 public static void LlenarDdlNS(DropDownList DdlTemp, DataTable dtConsulta, string texto, string valor)
 {
     DdlTemp.DataSource = dtConsulta;
     DdlTemp.DataTextField = texto;
     DdlTemp.DataValueField = valor;
     DdlTemp.DataBind();
 }
开发者ID:JavierTMC,项目名称:ASP.NET,代码行数:7,代码来源:Utilerias.cs

示例6: fillUnidades

    private void fillUnidades(DropDownList combo, int c)
    {
        combo.Enabled = false;
        combo.Items.Clear();
        combo.AppendDataBoundItems = true;
        combo.DataSource = psvm.getAllUnidades();
        combo.DataValueField = "UNI_COD";
        combo.DataTextField = "UNI_NOM";
        combo.DataBind();
        if (combo.Items.Count > 0)
        {
            combo.Enabled = true;

            cargo_comboUnidad_SelectedIndexChanged(combo, null);
        }
        else
        {
            combo.Enabled = false;

            combo.Items.Add(new ListItem("--Ninguno--", ""));
            cargo_comboArea.Enabled = false;
            cargo_comboArea.Items.Clear();
            cargo_comboArea.AppendDataBoundItems = true;
            cargo_comboArea.Items.Add(new ListItem("--Ninguno--", ""));
            cargo_comboArea.DataBind();

        }
    }
开发者ID:dacopan,项目名称:tathy-scpm,代码行数:28,代码来源:searchCargo.aspx.cs

示例7: BindDropDownList

 /// <summary>
 /// ��DropDownList�ؼ�����ʾ����,DropDownList�ؼ�Value,Textֵ���ֱ���ڵ���str_Value,str_Textֵ
 /// </summary>
 /// <param name="str_Value">��DropDownList�ؼ�Valueֵ���Ӧ���ݿ���ֶ���</param>
 /// <param name="str_Text">��DropDownList�ؼ�Textֵ���Ӧ���ݿ���ֶ���</param>
 /// <param name="ds">Select-SQL����ȡ������Դ</param>
 /// <param name="myDropDownList">DropDownList�ؼ�idֵ</param>
 public static void BindDropDownList(string str_Text, string str_Value, DataSet ds, DropDownList myDropDownList)
 {
     myDropDownList.DataSource = ds.Tables[0].DefaultView;
     myDropDownList.DataValueField = str_Value;
     myDropDownList.DataTextField = str_Text;
     myDropDownList.DataBind();
 }
开发者ID:loozhang,项目名称:51aspx_YiMengWeb,代码行数:14,代码来源:BindData.cs

示例8: BindAdminRegionsDropDown

 public static void BindAdminRegionsDropDown(String empNo, Roles role, ICacheStorage adapter, DropDownList d)
 {
     d.DataSource = BllAdmin.GetRegionsByRights(empNo, role, adapter);
     d.DataTextField = "Value";
     d.DataValueField = "Key";
     d.DataBind();
 }
开发者ID:raazalok,项目名称:IntranetHome,代码行数:7,代码来源:Utility.cs

示例9: BindColumns

 void BindColumns(DropDownList combo)
 {
     //combo.DataSource = Page.ReportManager.RetrieveColumnsSchema(Page.Settings.Report.ReportTablesSchemaId);
     combo.DataSource = Page.Settings.Columns;
     combo.DataBind();
     combo.Items.Insert(0, new ListItem("- - - - - - - - - - - - - -", ""));
 }
开发者ID:sidneylimafilho,项目名称:InfoControl,代码行数:7,代码来源:ReportGenerator_Sort.ascx.cs

示例10: Bind

 public static void Bind(DropDownList ddl)
 {
     DataTable dt = DataAccessFactory.GetDataAccess().SelectDataTable("select * from table_roles ", "tempdb");
     ddl.DataSource = dt;
     ddl.DataTextField = "c_name";
     ddl.DataValueField = "id";
     ddl.DataBind();
 }
开发者ID:romanu6891,项目名称:fivemen,代码行数:8,代码来源:RoleOperator.cs

示例11: CargaComboSeleccione

 public static void CargaComboSeleccione(DropDownList combo, DataTable dt, string valor, string texto)
 {
     combo.DataSource = dt;
     combo.DataValueField = valor;
     combo.DataTextField = texto;
     combo.DataBind();
     combo.Items.Insert(0, new ListItem("--SELECCIONE--", "0"));
 }
开发者ID:campivi,项目名称:MecanicsWorkOfficial,代码行数:8,代码来源:Utility.cs

示例12: BindNick

 public static void BindNick(DropDownList ddl, string type)
 {
     DataTable dt = DataAccessFactory.GetDataAccess().SelectDataTable("select * from table_departments where c_deptype='" + type + "'", "tempdb");
     ddl.DataSource = dt;
     ddl.DataTextField = "c_depnickname";
     ddl.DataValueField = "c_depcode";
     ddl.DataBind();
 }
开发者ID:romanu6891,项目名称:fivemen,代码行数:8,代码来源:DepartMentOperator.cs

示例13: BindLookupDropDown

 public static void BindLookupDropDown(DropDownList ddl, SqlDataReader dataSource, string dataTextField, string dataValueField)
 {
     ddl.DataSource = dataSource;
     ddl.DataTextField = dataTextField;
     ddl.DataValueField = dataValueField;
     ddl.DataBind();
     ddl.Items.Insert(0, "");
 }
开发者ID:prasannapattam,项目名称:ExamPatient,代码行数:8,代码来源:WebUtil.cs

示例14: BindDropDownList

 public static void BindDropDownList(string typename,DropDownList ddl)
 {
     DataTable dt = DataAccessFactory.GetDataAccess().SelectDataTable("select * from table_dicts where c_typename ='" + typename + "'", "tempdb");
     ddl.DataSource = dt;
     ddl.DataTextField = "c_dict_text";
     ddl.DataValueField = "c_dict_value";
     ddl.DataBind();
 }
开发者ID:romanu6891,项目名称:fivemen,代码行数:8,代码来源:DictOperator.cs

示例15: Bind2

 public static void Bind2(DropDownList ddl)
 {
     DataTable dt = DataAccessFactory.GetDataAccess().SelectDataTable("select * from table_departments ", "tempdb");
     ddl.DataSource = dt;
     ddl.DataTextField = "c_depfullname";
     ddl.DataValueField = "c_depcode";
     ddl.DataBind();
 }
开发者ID:romanu6891,项目名称:fivemen,代码行数:8,代码来源:DepartMentOperator.cs


注:本文中的DropDownList.DataBind方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。