Dyanamic image button creation RRS feed

  • Question

  • User-616340081 posted
    am trying to create a web page in ASP.NET using C# .Here my web page is linked with an folder in server.Every time it loads , it has to check dynamically the no of images in that folder and according to that create image buttons, and fill them with the images in the folder
    Friday, February 11, 2005 12:09 AM

All replies

  • User-616340081 posted
    hi I think I found the solution , I am posting , it may sound silly , like I post the question and then the answer. As many people have visited this thread I think you would be interested in the solution. I started with .net jus 3 weeks ago. So probably there are better solutions. to create an image button in run time : ----------------------------------------------- Use a place holder that is available in visual studio 2003 Then call the image button or any other you want to use from it base class. Pass an object to it .Then Along with the place holder add this object. You want it many time then put it in a loop. Every thing would be taken care by the JIT. To count the no of images in run time And load them into these image button: ------------------------------------------------------------------------------------------ As for the picture are concerned use the fileinfo class put the *.jpg in it or any other extension of the image, I am yet to figure how to use more than one extension. Put it in a " foreach ( fileinfo a in s) { code for adding the image button }" .Here s is also fileinfo ,To connect with the directory of the image use directory info class. It is a fully automated photo gallery. It will check for the no of files of a particular extension and load them in a fly. All code is generated in run time. But I am yet to figure out how to link a click events for these image button. What I want to do is when a particular image button is clicked it should bring a message box with that file name, normally it can be done. But as the image button is created in run time I am yet to figure it.
    Saturday, February 26, 2005 8:42 AM