Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 27, 2012 04:47 AM by sameer_khanjit
Dec 22, 2012 05:34 PM|LINK
I stored some images directly in my database. At the moment I am displaying the images in a GridView that includes an select link in each row. I want that behavior: If I click on the select link, a new image control should be created and the image url shall
be set to the my image handler including the image ID to display the image.
Because of the stateless web site I have to recreate each image control. I save already the number of images in the view state. But how can I recreate the image controls with the correct image url? I have to save it, but how/where? I cannot create a new
variable in the view state for each image, could I?
thank you very much for your help!
Dec 26, 2012 12:57 PM|LINK
I guess, I can't fully understand your situation.. but about viewstates surely you can.. you just have to devise a mechanism to name viewstate variables.. Here I suggest an approach.. append the grid RowIndex with viewstate name to uniquely identify viewstate
variable for each row.
ViewState["myPhoto" + GridView1.SelectedRow.RowIndex.ToString()]= "your value";
Dec 26, 2012 11:48 PM|LINK
thank you for your answer.
See the following situation: I have a gridview, filled with images out of the database. When I click select, a new Image control is created in an update panel. The imageurl refers to imagehandler.ashx?ID=x. Because of the async post back of the update panel,
I have to recreate all existing image controls + the new image control. That means, in this case all images are pulled out of the database again. And I want to reduce this traffic. Is it possible?
Hopefully it was clear now. It is a little bit difficult to describe in a few sentence and more difficult to understand. Sorry about this! :)
Dec 27, 2012 04:47 AM|LINK
you can show that image in POPUP(Model window).
1) First put one div outside of Update panel.
2)Add one image (html) control in div.
4)Assign image url in image control.
5)Show model window.