Dynamic Image based on Datalist Item in ModalPopup Extender

Hi,

My website has a Datalist bound to a Dataset. One of the Items in the Datalist is an Image. I created a Details Button next to the Image and would like to open the Image and some other information in a ModalPopup Extender.

The ModalPopUp Extender Opens, but i dont know how i can assign the Image Dynamically.

Is it possible?

Thanks
LVL 3
Sebastian_OHAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

masterpassCommented:
Since you want it dynamically, I would advice for a PageMethod to be called which will do a request in the codebehind and fetch the url and when you get the response you can assign it to the imageurl of the image

Just see this article

http://www.experts-exchange.com/articles/Programming/Languages/Scripting/AJAX/NET-AJAX-callbacks-to-ASPX-Pages.html
0
Sebastian_OHAuthor Commented:
If there is a better solution im open for it.

I just need to bring up a details page for products in a Datalist. The Image is stored in SQL.

Thanks
0
Sebastian_OHAuthor Commented:
I still have problems with the modal popup.

I configured a Details button in my Datalist with a command and a command argument. The command Argument is set to the Primary Key in the Database.
I am able to open the details page in a new window, but the Button COmmand does not fire before the ModalPopup.

0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

masterpassCommented:
it is quite normal .. You will have the modal popup extender firing before the command ...
0
Sebastian_OHAuthor Commented:
Can i change the order somehow ?

Sorry the whole stuff is still new for me :P
0
masterpassCommented:
I am afraid you cannot ... it is because you have given the modalpopup launching control as the details button ....

What you can do is on the row data bound event ... you can find this details button and then

detailsbutton.attributes.add("onclick","passcommandargument('"+here get the command argument+"');");

passcommandargument(command) will be a javascript function which will be invoked when you click the button(i m not sure whether this will have some effect on modal popup)... so you will get your PK on JS and you can pass it on to your code behind using PageMethods ...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Sebastian_OHAuthor Commented:
Here is another thought. Can i just make the ModalPopupExtender Part of my Datalist item.
Change the DynamicContextKey to my PK and create a method in my Code behind to load the image?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.