Friday, June 12, 2009

How to use Repeater in c#



protected void lbtncreate_Click(object sender, EventArgs e)
{

multiview.ActiveViewIndex = 1;
cmd=new SqlCommand("select title from " + Session["a"] + "", con);
da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
ArrayList al = new ArrayList();
for (int i = 0; i <= ds.Tables[0].Rows.Count - 1; i++)
{
al.Insert(i, ds.Tables[0].Rows[i][0].ToString());
}
repeater.DataSource = al;
repeater.DataBind();
}

1 comment: