i keep getting this and nothin is helpful can some one solve this error i am addinfg images at runtime and links are fetched from db and dynamic image control are made but this error is getting in my way.
Multiple controls with the same ID ‘projectimg8’ were found. FindControl requires that controls have unique IDs.
string get = ListBox1.SelectedItem.Text;
DataSet ds = con.getprojectgallery(get);
if (ds!=null)
{
int count = ds.Tables[0].Rows.Count;
for (int i = 0; i < count; i++)
{
Image img = new Image();
img.ID = "projectimg" + count.ToString();
img.ImageUrl = ds.Tables[0].Rows[0][0].ToString();
img.Height = 80;
img.Width = 80;
img.ToolTip = ds.Tables[0].Rows[0][1].ToString();
pnlgallery.Controls.Add(img);
pnlgallery.Controls.Add(new LiteralControl("<br />"));
}
Change it to:
You need the incremented count, not the count variable itself.