• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 730
  • Last Modified:

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
0
Sebastian_OH
Asked:
Sebastian_OH
  • 4
  • 3
1 Solution
 
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
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
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
 
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

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now