本文整理汇总了C#中System.DataBind方法的典型用法代码示例。如果您正苦于以下问题:C# System.DataBind方法的具体用法?C# System.DataBind怎么用?C# System.DataBind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System
的用法示例。
在下文中一共展示了System.DataBind方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: fillDropDownItems
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;
}
}
示例2: binddrop
protected void binddrop(string message, System.Web.UI.WebControls.DropDownList drop)
{
drop.DataSource = comtypeBll.getType(message);
drop.DataTextField = "tname";
drop.DataValueField = "id";
drop.DataBind();
}
示例3: fillListedUnitGroups
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;
}
}
示例4: comboRellenar
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();
}
示例5: GetDropDownListBind
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();
}
示例6: GetDropDownListBind
//根据数据,生成下拉列表
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();
}
示例7: fillListBoxItems
/// <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;
}
}
示例8: fillListBox
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;
}
}
示例9: fillDropDownItems
/// <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;
}
}
示例10: Paggination
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();
}
示例11: LogTypeBind
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("请选择操作类型", ""));
}
示例12: GetOperatTableBind
//绑定已经存在数据库中的表(特定用在日志中的操作表)
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("请选择操作表", ""));
}
示例13: CarregarCombo
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();
}
示例14: BindSysResCheckBoxList
//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();
}
示例15: LoadQuiz_FillInTheBlanksDetailsPage
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);
}