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?
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.
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! :)
_Stefan_
0 Points
15 Posts
Add controls and save their value
Dec 22, 2012 05:34 PM|LINK
Hi,
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!
Stefan
deepthoughts
Contributor
7288 Points
1051 Posts
Re: Add controls and save their value
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.
Thanks.
_Stefan_
0 Points
15 Posts
Re: Add controls and save their value
Dec 26, 2012 11:48 PM|LINK
Hi,
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! :)
regards,
Stefan
sameer_khanj...
Contributor
7056 Points
1376 Posts
Re: Add controls and save their value
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.
3) Just call one javascript function on click of Link
4)Assign image url in image control.
5)Show model window.
http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/ModalPopup/ModalPopup.aspx
sameer.khanjit@gmail.com
View Blog
Click "Mark as Answer" on the post that helped you.