本文整理汇总了C#中System.Web.UI.WebControls.CheckBoxList.DataBind方法的典型用法代码示例。如果您正苦于以下问题:C# CheckBoxList.DataBind方法的具体用法?C# CheckBoxList.DataBind怎么用?C# CheckBoxList.DataBind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.WebControls.CheckBoxList
的用法示例。
在下文中一共展示了CheckBoxList.DataBind方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ChkListFill
public static void ChkListFill(ref CheckBoxList chkl, object list)
{
chkl.DataTextField = listDefaultDataTextField;
chkl.DataValueField = listDefaultDataValueField;
chkl.DataSource = list;
chkl.DataBind();
}
示例2: setCheckBoxList
public void setCheckBoxList(CheckBoxList chl, DataSet ds, string display, string value)
{
chl.DataSource = ds;
chl.DataTextField = display;
chl.DataValueField = value;
chl.DataBind();
}
示例3: MultipleSelectControl
public MultipleSelectControl(MultipleSelect item, RepeatDirection direction)
{
this.item = item;
l = new Label();
l.Text = item.Title;
l.CssClass = "label";
l.AssociatedControlID = item.Name;
this.Controls.Add(l);
list = new CheckBoxList();
list.RepeatDirection = direction;
list.ID = item.Name;
list.CssClass = "alternatives";
list.DataSource = item.GetChildren();
list.DataTextField = "Title";
list.DataValueField = "ID";
list.DataBind();
this.Controls.Add(list);
if (item.Required)
{
cv = new CustomValidator { Display = ValidatorDisplay.Dynamic, Text = "*" };
cv.ErrorMessage = item.Title + " is required";
cv.ServerValidate += (s, a) => a.IsValid = !string.IsNullOrEmpty(AnswerText);
cv.ValidationGroup = "Form";
this.Controls.Add(cv);
}
}
示例4: populate
public static void populate(CheckBoxList element, int id_equipe)
{
element.DataSource = controller().find_by_equipe(id_equipe);
element.AppendDataBoundItems = true;
element.DataTextField = "nome";
element.DataValueField = "id";
element.DataBind();
}
示例5: FillCheckBoxList
public void FillCheckBoxList(CheckBoxList chk, DataTable mydt, string textField, string valueFeild)
{
chk.DataSource = mydt;
chk.DataValueField = valueFeild;
chk.DataTextField = textField;
chk.DataBind();
chk.Items.Insert(0, new ListItem { Value = "0", Text = "All", Selected = false });
}
示例6: populateCheckbox
public static void populateCheckbox(CheckBoxList element)
{
element.DataSource = controller().index();
element.AppendDataBoundItems = true;
element.DataTextField = "nom_disc";
element.DataValueField = "id";
element.DataBind();
}
示例7: FillCheckBoxList
public void FillCheckBoxList(ref CheckBoxList objchkList, string strQuery, string strTextField, string strValueField, string strOrderBy, string strQueryCondition = "")
{
dsCommon = new DataSet();
dsCommon = CrystalConnection.CreateDatasetWithoutTransaction(strQuery + " " + strQueryCondition + " " + strOrderBy);
objchkList.DataTextField = strTextField;
objchkList.DataValueField = strValueField;
objchkList.DataSource = dsCommon.Tables[0].DefaultView;
objchkList.DataBind();
}
示例8: AllSizes
/// <summary>
/// Load All Sizes in CheckBox Collections.
/// </summary>
public static void AllSizes(CheckBoxList SizeschkBxs, List<StyleSize> sizes=null)
{
List<Size> sizes_list = SM.Sizes();
if (sizes == null)
{
SizeschkBxs.DataSource = SM.Sizes();
SizeschkBxs.DataValueField = "SizeCode";
SizeschkBxs.DataTextField = "SizeDescription";
SizeschkBxs.DataBind();
}
else
{
var results = (from size in sizes_list
join s_size in sizes on size.SizeCode equals s_size.SizeCode
select size).ToList<Size>();
SizeschkBxs.DataSource = sizes_list.Except(results);
SizeschkBxs.DataValueField = "SizeCode";
SizeschkBxs.DataTextField = "SizeDescription";
SizeschkBxs.DataBind();
}
}
示例9: AllColors
/// <summary>
/// Load All Colors in CheckBox Collections.
/// </summary>
public static void AllColors(CheckBoxList ColorchkBx, List<StyleColor> colors= null)
{
List<Color> color_list = CM.Colors();
if (colors == null)
{
ColorchkBx.DataSource = CM.Colors();
ColorchkBx.DataValueField = "ColorCode";
ColorchkBx.DataTextField = "ColorDescription";
ColorchkBx.DataBind();
}
else
{
var results = (from color in color_list
join s_color in colors on color.ColorCode equals s_color.ColorCode
select color).ToList<Color>();
ColorchkBx.DataSource = color_list.Except(results);
ColorchkBx.DataValueField = "ColorCode";
ColorchkBx.DataTextField = "ColorDescription";
ColorchkBx.DataBind();
}
}
示例10: FillDataToCheckboxList
public static void FillDataToCheckboxList(CheckBoxList control, string table, string dataTextField, string dataValueField)
{
OpenData();
string strCommand = "SELECT " + dataTextField + ", " + dataValueField + " FROM " + table;
da = new SqlDataAdapter(strCommand, con);
ds = new DataSet();
da.Fill(ds, strCommand);
control.DataSource = ds;
control.DataTextField = dataTextField;
control.DataValueField = dataValueField;
control.DataBind();
CloseData();
}
示例11: FillDataToCheckBoxList
public static void FillDataToCheckBoxList(CheckBoxList control, string table, string dataTextField, string dataValueField)
{
opendata();
string strCommand = "SELECT " + dataTextField + ", " + dataValueField + " FROM " + table;
sqladapter = new SqlDataAdapter(strCommand, sqlconn);
mydata = new DataSet();
sqladapter.Fill(mydata, strCommand);
control.DataSource = mydata;
control.DataTextField = dataTextField;
control.DataValueField = dataValueField;
control.DataBind();
closedata();
}
示例12: Concessionaria
public static void Concessionaria(CheckBoxList ck)
{
try
{
ck.DataSource = CRB.BOSS.Autenticacao.Concessionaria.Concessionaria.CarregarConcessionariasAutenticadas();
ck.DataValueField = "ID";
ck.DataTextField = "Nome";
ck.DataBind();
CRB.BOSS.Auditoria.Log.Log.Salvar("Carregar CheckBoxList de Concessionaria", CRB.BOSS.Auditoria.Log.InformacoesLog.Information, CRB.BOSS.Autenticacao.Modulo.Modulo.Funcionalidade, CRB.BOSS.Autenticacao.Modulo.Modulo.Atual);
}
catch (Exception ex)
{
CRB.BOSS.Auditoria.Log.Log.Salvar(ex.Message, CRB.BOSS.Auditoria.Log.InformacoesLog.Information, CRB.BOSS.Autenticacao.Modulo.Modulo.Funcionalidade, CRB.BOSS.Autenticacao.Modulo.Modulo.Atual);
throw ex;
}
}
示例13: StationOfChannelBind
/// <summary>
///
/// </summary>
/// <param name="channelID"></param>
/// <param name="cblStation"></param>
/// <param name="deviceTypes"></param>
/// <param name="isSelected"></param>
public static void StationOfChannelBind(int channelID, CheckBoxList cblStation, string[] deviceTypes, bool isSelected)
{
ChannelClass ch = ChannelFactory.CreateChannel(channelID);
if (ch != null)
{
StationCollection sts = ch.StationCollection.GetStationCollection(deviceTypes);
ListItemCollection stationList = GetStationListItemCollection(sts);
cblStation.DataTextField = "Text";
cblStation.DataValueField = "Value";
cblStation.DataSource = stationList;
cblStation.DataBind();
foreach (ListItem stitem in cblStation.Items)
{
stitem.Selected = isSelected;
}
}
}
示例14: FillToCheckBoxList
public void FillToCheckBoxList(CheckBoxList checkboxlist, DataTable datatable, string displayMember, string valueMember)
{
if (datatable != null)
{
checkboxlist.DataSource = datatable;
checkboxlist.DataTextField = displayMember;
checkboxlist.DataValueField = valueMember;
}
else
{
checkboxlist.DataSource = null;
}
checkboxlist.DataBind();
}
示例15: LoadCheckBoxList
public static bool LoadCheckBoxList(CheckBoxList _CheckBoxList, object objData, string dataTextField,
string dataValueField)
{
if (objData != null)
{
_CheckBoxList.DataSource = null;
_CheckBoxList.Items.Clear();
_CheckBoxList.DataSource = objData;
_CheckBoxList.DataTextField = dataTextField;
_CheckBoxList.DataValueField = dataValueField;
try
{
_CheckBoxList.DataBind();
}
catch
{
return false;
}
return true;
}
return false;
}