大家帮忙,我做不出来了,帮个忙吧
我想用编程的方式,在网页上插入imageButton控件,控件的数量通过数据库中读出,控件的imageurl也是通过数据库中读出来的,然后点击这个imagebutton控件能返回点击这个控件对应的teacid。目前已经写到这里了后面不知道怎么写了
protected void Page_Load(object sender, EventArgs e)
{
//自己写的类,实现打开和返回dataset
dbConn ds = new dbConn();
string sl = "select teacid,teacname,teacimage from teacher";
DataSet viset = new DataSet();
viset=ds.viewdb(sl);
ArrayList aa = new ArrayList();
for (int i = 0; i < viset.Tables[0].Rows.Count; i++)
{
aa.Add(new ImageButton());
((ImageButton)(aa[i])).ImageUrl = "~/teacimage/" + viset.Tables[0].Rows[i][2];
((ImageButton)(aa[i])).Height = 100;
((ImageButton)(aa[i])).Width = 80;
form1.Controls.Add(((Image)(aa[i])));
((ImageButton)(aa[i])).Click+=new ImageClickEventHandler(ViewTeacher_Click);
}
}
[[it] 本帖最后由 fanboy 于 2008-11-28 22:10 编辑 [/it]]