Find item in datasource from button click in template

3 posts, 1 answers
  1. Peter
    Peter avatar
    22 posts
    Member since:
    Nov 2007

    Posted 02 Oct 2013 Link to this post

    I have a databound listview with the data being displayed via template.  In my template I have a button.  How can I get the associated data item when the button is clicked?

  2. Answer
    Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 03 Oct 2013 Link to this post

    Hello Peter,

    The templates have access to the current dataItem through the data object. In case you are calling an external function from the template you could pass it the dataItem's uid. This will allow you to get the same dataItem from the external function. I created this small example to illustrate such behavior.
     

    Regards,
    Alexander Popov
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Peter
    Peter avatar
    22 posts
    Member since:
    Nov 2007

    Posted 03 Oct 2013 Link to this post

    Thanks for the quick response.  That was exactly what I needed.
Back to Top