Command accessing DOM

2 posts, 0 answers
  1. David Kyle
    David Kyle avatar
    2 posts
    Member since:
    Sep 2009

    Posted 05 Mar 2013 Link to this post

    Hi,

    Dynamically adding docks and I want when the user clicks the command button to show or hide a div within the widget. I can do this with a javascript function on the ascx page, but once I add more than one the function becomes ambiguous with each copy having the same javascript function.

    The ascx file will have a function like:

    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script>
        function temper(dock, args) {
            $('#<%= temperDiv.ClientID%>').hide("slow");
        }    
    </script>
    </telerik:RadCodeBlock>
    <div id="temperDiv" runat="server" >

  2. Slav
    Admin
    Slav avatar
    1356 posts

    Posted 08 Mar 2013 Link to this post

    Hello David,

    I will post here the information that I provided in your support ticket on the matter:

    You can use the RegisterStartupScript method of ScriptManager to register a unique handler function for every RadDock you add dynamically on the page.

    Another option is to use the dock parameter that is passed to the event handler. This parameter contains a reference to the client-side object of the dock, the command of which is clicked. It will allow you to get the current dock and find the element in its content that you want to manipulate.

    I would suggest continuing our discussion in the support ticket if you need additional help with configuring the client-side handler.

    All the best,
    Slav
    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