Add JS function from C#

3 posts, 1 answers
  1. Maxime
    Maxime avatar
    37 posts
    Member since:
    May 2012

    Posted 03 Jul 2013 Link to this post

    Hi everybody,

    I would like to know if it is possible to set a JS function of a tileList in code-behind (SelectionStateChanged), and how.
    I have already created a JS function that i want to be launched when the tile is selected.

    I try to create every tileList i need from code-behind, that is why i need this.

    Many thanks !
  2. Answer
    Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 04 Jul 2013 Link to this post

    Hi Maxime,

    If you already have the desired function on the page you can point the OnClientTileSelected or OnClientTileSelecting property of the RadTileList to the desired event handler's name. The list with the properties that pass the client-side event handlers is available here: http://www.telerik.com/help/aspnet-ajax/tilelist-server-side-tilelist-object.html.
    Here is a small example

    in the code-behind
    RadTileList tl = new RadTileList();
    tl.OnClientTileSelected = "myHandler";
    while the function is declared in the markup or is in a JS file that is referenced by the page:
    function myHandler(sender, args)
    {
     
    }



    Regards,
    Marin Bratanov
    Telerik
    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 the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Maxime
    Maxime avatar
    37 posts
    Member since:
    May 2012

    Posted 05 Jul 2013 Link to this post

    Hi,

    Many thanks for the advice, it works :)

    Regards,
    Maxime.
Back to Top