Tuesday, September 4, 2007

Dynamic Image button in VB.NET


I have dynamically generate the image buttons based upon images in a pointed directory.

The problem that I'm experiencing is giving it an onclick event to function properly.



This is exactly what I'm attempting to achieve:

1. Generate Image Button Dynamically. (GO)
2. Bind OnClick Event to Image Button. (GO)
3. Retrieving Properties from Image Button. (No GO)



In General,
Dynamic Image Button -> Button Click -> Call Server-Side Function...
-> Return Image Button Properties -> Use Properties ie. Image URL...
-> Store Image URL to database.




This is what I'm attempting to call when an Image Button Event is raised.

public void

showSelected(string imgUrl)
{

selectedImage.Controls.Add(
new LiteralControl("


"));
selectedImage.Controls.Add(
new LiteralControl("You have Selected

"));

Image img = new Image();
img.Width = 128;
img.Height = 128;
img.ImageUrl =



"renderBitmap.aspx?img=" + imgUrl + "&width=128&height=128";
selectedImage.Controls.Add(img);


}

0 comments;Click here for request info on this topic:

Post a Comment