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

Command accessing DOM

1 Answer 25 Views
Dock
This is a migrated thread and some comments may be shown as answers.
David Kyle
Top achievements
Rank 1
David Kyle asked on 05 Mar 2013, 08:57 PM
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" >

1 Answer, 1 is accepted

Sort by
0
Slav
Telerik team
answered on 08 Mar 2013, 05:49 PM
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.
Tags
Dock
Asked by
David Kyle
Top achievements
Rank 1
Answers by
Slav
Telerik team
Share this question
or