Image Gallery Demo : OnClick event for RadBinaryImage inside RadListView control

2 posts, 0 answers
  1. Abhijit
    Abhijit avatar
    1 posts
    Member since:
    May 2008

    Posted 26 Mar 2012 Link to this post

    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

     

  2. Tsvetina
    Admin
    Tsvetina avatar
    1876 posts

    Posted 29 Mar 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top