Search My Warehouse

2009-10-26

fill ListBox ,CheckBoxList programetically

public CheckBoxList ChkBxLst(CheckBoxList ck, DataTable MyDT)
{
ck.Items.Clear();
for (int i = 0; i < MyDT.Rows.Count; i++)
{
ck.Items.Add(MyDT.Rows[i][0].ToString());
}
return ck;
}

public ListBox MyListBox (ListBox LB, DataTable MyDT)
{
LB.Items.Clear();
for (int i = 0; i < MyDT.Rows.Count-2; i++)
{
LB.Items.Add(MyDT.Rows[i][0].ToString());
}
return LB;
}

No comments:

Feed