asp.net - Help Multiple controls with the same ID '' were found. FindControl requires that controls have unique IDs -


i keep getting , nothin helpful can 1 solve error addinfg images @ runtime , links fetched db , dynamic image control made error getting in way. multiple controls same id 'projectimg8' found. findcontrol requires controls have unique ids.

   string = listbox1.selecteditem.text;     dataset ds = con.getprojectgallery(get);     if (ds!=null)     {         int count = ds.tables[0].rows.count;         (int = 0; < 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 to:

img.id = "projectimg" + i.tostring(); 

you need incremented count, not count variable itself.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -