C# Dynamically added Event Handles (?)

Joined
Jul 21, 2008
Messages
1
Reaction score
0
Hi All.. (Be Gentle.. I'm new :oops: ) using C#.. below is my snippit of code..

I am Dynamically (While there a more .jpg's in a dir)
adding cells to a table with an image and a button

Question ..
How do I add a :
  • MouseOver/MouseOut event to the Image and a
  • Clicked event to the Button

TableRow r = new TableRow();
for (int i = 0; i < numCells; i++) {
TableCell c = new TableCell();
if(count < numFiles){

label1.Text = "here 2";

fileName = files[count].ToString();
int LastIndex = fileName.LastIndexOf("\\");
fileName = fileName.Substring(LastIndex+1,(fileName.Length - LastIndex -1));

Image theImage = Make_Image(theDir + "/" + fileName);
Image theOtherImage = Make_OtherImage(theDir + "/" + fileName);
Button theButton = Make_Button(fileName);
c.Controls.Add(new LiteralControl("<div id='pic'><a href='#'>"));
c.Controls.Add(theImage);
c.Controls.Add(theOtherImage);
c.Controls.Add(new LiteralControl("</a></div>"));
c.Controls.Add(theButton);
}
r.Cells.Add(c); count++;
}
Table1.Rows.Add(r);



Loveuuz all....

Darren.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top