如何在列表中存储值 [英] how to store values in list
本文介绍了如何在列表中存储值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
string valu1 = Convert.ToString(ds.Tables[0].Rows[0]["name"]);
string valu2 = Convert.ToString(ds.Tables[0].Rows[1]["name"]);
string valu3 = Convert.ToString(ds.Tables[0].Rows[2]["name"]);
Label lbl = new Label();
lbl.Text = valu1;// list values store here
cell.Controls.Add(lbl);
row.Cells.Add(cell);
推荐答案
检查此
Hi ,
Check this
List<string> lst = new List<string>();
string valu1 = Convert.ToString(ds.Tables[0].Rows[0]["name"]);
string valu2 = Convert.ToString(ds.Tables[0].Rows[1]["name"]);
string valu3 = Convert.ToString(ds.Tables[0].Rows[2]["name"]);
lst.Add(valu1);
lst.Add(valu2);
lst.Add(valu3);
foreach (string item in lst)
{
TableRow tr = new TableRow();
TableCell tc = new TableCell();
Label lb = new Label();
lb.Text = item;
string ids = string.Format("lb{0}",i);
lb.ID = ids;
tc.Controls.Add(lb);
tr.Controls.Add(tc);
Table1.Controls.Add(tr);
i++;
}
form1.Controls.Add(lbl);
最好的问候
M.Mitwalli
form1.Controls.Add(lbl);
Best Regards
M.Mitwalli
List<string> valueslist=new List<string>();
valueslist.add("abc");
valueslist.add("def");
valueslist.add("ghi");
valueslist.add("jhkl");
嗨 如果您尝试在运行时添加
这可能有助于您
http://stackoverflow.com/questions/4864880/how-to-目标[ ^ ]
http://senchaexamples .com/2012/03/21/dynamically-adding-items-to-an-ext-list-control-in-sencha-touch-2/ [
hi if u r trying to add at runtime
this may helps to u
http://stackoverflow.com/questions/4864880/how-to-populate-a-dropdownlist-using-a-listlistitem[^]
http://senchaexamples.com/2012/03/21/dynamically-adding-items-to-an-ext-list-control-in-sencha-touch-2/[^]
2)suppose if u want to add in orgramatecally
hitec_s correct.
这篇关于如何在列表中存储值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文