This is a migrated thread and some comments may be shown as answers.

Image Gallery Demo : OnClick event for RadBinaryImage inside RadListView control

1 Answer 339 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Abhijit
Top achievements
Rank 1
Abhijit asked on 26 Mar 2012, 03:48 PM
Hello,

  1. Understanding:
    1. In the code for the Image Gallery Demo using RadListView control, a RadBinaryImage control has been used.
    2. In the aspx page, a "onclick="<%#CreateWindowScript((TiledImages) Container.DataItem) %>"/>" event has been used.
    3. Also, if we run the program in debug mode and place a break point on the "CreateWindowScript" method defined in the code behind, we will see that this method is getting called at "Page_Load" itself.
    4. What i understand is its trying to register a Java Script for the click event when ever it occurs.
  2. Requirement:
    1. The images to be shown are stored in the data base.
    2. My requirement is that once the page is loaded and the user clicks on any of the image, I want to call a server side (code behind) method.
    3. Based on the selected Image and its ID, I want to load few other controls with data from the data base.
    4. As far as I understand, the onclick event used in the demo will not serve the purpose.
    5. What other option can I look out for for the above mentioned requirement?
    6. Note: In our project, we plan to use this image gallery in a form of a Live Tile in a ASP.NET application. And hence the usage of ListView and RadBinaryImage control.

A quick input towards the solution will be very helpful.

Regards,
Abhijit

 

1 Answer, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 29 Mar 2012, 09:24 AM
Hello Abhijit,

Here is a possible approach that you could take for this scenario:

You can see a RadListView showing RadBinaryImages populated from DB here:
http://demos.telerik.com/aspnet-ajax/binaryimage/examples/default/defaultcs.aspx

For raising a server event on clicking an image, you could use the onclick client event handler to raise an ajax callback, through the ajaxRequest client method of RadAjax:
http://www.telerik.com/help/aspnet-ajax/ajax-client-side-api.html
You can pass the ID as an argument of this method, so in the server AjaxRequest event you can access it from e.Argument.

Kind regards,
Tsvetina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
ListView
Asked by
Abhijit
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Share this question
or