Welcome Guest Search | Active Topics | Sign In | Register

Callback Panel Imagebutton in Datalist Options
Jim
Posted: Friday, February 13, 2009 9:52:40 AM
Rank: Newbie
Groups: Member

Joined: 1/29/2009
Posts: 6
I may be going about this the wrong way and if so I would appreciate redirection. Currently I have a datalist containing an image. The image(s) that are displayed depends on what selection is made by the visitor. The datalist acts as a sort of gallery, that contains thumbnail(s) of the product being displayed. There may be only 1 or up to 10 photos of each product. When the visitor clicks on the thumbnail the main image changes accordingly.

This is currently working but with a refresh of the screen. I have been trying to tie this in to the callback panel in order to prevent the entire page being reposted but have not been able to figure out a way of tying the trigger event of the thumbnail image(s) click event which are generated within the datalist.

Using a ImageButton outside of the datalist works great. But the number of ImageButtons will vary based on the product selected.

I appreciate any assistance getting the callback panel to handle this scenario.

Sincerely,

Jim
eo_support
Posted: Friday, February 13, 2009 10:20:31 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

It appears that you need to put in some JavaScript code. :) There are two ways to trigger the CallbackPanel. One with trigger and the other with JavaScript code.

Using trigger is easy. You simply edit the CallbackPanel's trigger collection. There is one feature that may help you, is that you can actually use the parent control as a trigger. For example, if you have a Panel that includes two ImageButtons, you can set the Panel as a trigger instead of setting those two ImageButtons as triggers. Set a parent control as a trigger would enable all child controls as triggers.

The other option is to use eo_Callback client side JavaScript function:

http://doc.essentialobjects.com/library/1/jsdoc.public.global.eo_callback.aspx

This is a JavaScript function that you can call anywhere in your client side code (Obviously you will need to figure out how and where to call this function). The function triggers a callback and brings you back to the server side, where you can do whatever you want such as updating another control inside the CallbackPanel. The key difference between this approach and the trigger approach is this approach is not directly associated with a "trigger control", so you do not have a distinctive event handler on the server side to fill. On the other hand, if you use the trigger approach, for example, a standard Button as a trigger, you would do whatever you want to do inside your server side Button_Click handler. When you use JavaScript to trigger Callback, such Button_Click handler doesn't exist because the callback wasn't directly triggered by any control at the very first place. As a result, you can perform your action mostly in two places: Page_Load and Callback_Execute handler. If you do it inside Page_Load handler, you usually will need to have code to check whether the current request is a callback:

http://doc.essentialobjects.com/library/1/eo.web.callbackpanel.iscallback.aspx
http://doc.essentialobjects.com/library/1/eo.web.callbackpanel.iscallbackbyme.aspx

You can also handle the CallbackPanel's Execute event, however that event is fired at a relative late stage of the page's life cycle, so it may or may not work for you.

Hope this helps. Please feel free to let us know if you have any more questions.

Thanks!
Jim
Posted: Friday, February 13, 2009 11:08:56 AM
Rank: Newbie
Groups: Member

Joined: 1/29/2009
Posts: 6
Got it working and once again I salute your team on both the response time and quality of support.

Just in case anyone else runs into this issue, I used the ItemCommand event of the datalist to capture the click event of the thumbnail and tied the CallBack trigger to the datalist.

Works like a dream!

Thank You!!!

Jim
eo_support
Posted: Friday, February 13, 2009 11:12:25 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
That's a neat solution. Thanks for sharing!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.