Find raddock clientside object on click of radbutton inside the content template of raddock

5 posts, 0 answers
  1. Chetan
    Chetan avatar
    13 posts
    Member since:
    Sep 2012

    Posted 03 Dec 2013 Link to this post

    Hi I have a radbutton inside content template of the raddock.. How do I get hold of raddock client object on client clicked event of radbutton? Thanks!
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 03 Dec 2013 Link to this post

    Hi Chetan,

    Please have a look into the following code snippet to access the RadDock Client side object in RadButton OnClientClicked event.

    ASPX:
    <telerik:RadDock ID="RadDock1" runat="server">
        <ContentTemplate>
            <telerik:RadButton ID="RadButton1" runat="server" Text="Get RadDock" AutoPostBack="false"
                OnClientClicked="OnClientClicked1">
            </telerik:RadButton>
        </ContentTemplate>
    </telerik:RadDock>

    JavaScript:
    <script type="text/javascript">
        function OnClientClicked1(sender, args) {
            var dock = $find("<%=RadDock1.ClientID %>");
            //your code
        }
    </script>

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Chetan
    Chetan avatar
    13 posts
    Member since:
    Sep 2012

    Posted 04 Dec 2013 Link to this post

    Thanks Shinu,
    But that is not what I am looking for.
    Let me explain the scenario.. 

    I have 6 radDockZone and each one has atleast 1 RadDock on Initiating. Now that each RadDock has contentTemplate with user Control and this userControl has RadButton And RadTextBox. So I will have to write mulitple clientScripts if I want to use <% RadDock.ClientID %> ..
    But Instead I want to use same clientFunction so is there a way that on RadButtonClick I can get something like sender.parentItem.parentItem to get hold of the containing radDock ?
  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 04 Dec 2013 Link to this post

    Hi Chetan,

    Please have a look into the sample code snippet which works fine at my end.

    ASPX:
    <telerik:RadDockZone ID="RadDockZone1" runat="server">
        <telerik:RadDock ID="RadDock1" runat="server" OnClientInitialize="OnClientInitialize1">
            <ContentTemplate>
                <uc1:WebUserControl ID="WebUserControl1" runat="server" />
            </ContentTemplate>
        </telerik:RadDock>
    </telerik:RadDockZone>

    ASCX:
    <telerik:RadTextBox ID="RadTextBox1" runat="server">
    </telerik:RadTextBox>
    <telerik:RadButton ID="RadButton1" runat="server" Text="Click" AutoPostBack="false"
        OnClientClicked="OnClientClicked">
    </telerik:RadButton>

    ASPX JavaScript:
    <script type="text/javascript">
        var dock;
        function OnClientInitialize1(sender, args) {
            dock = sender;
        }
        function OnClientClicked(sender, args) {
            //the dock variable have all the properties and method of the parent raddock
            alert(dock._uniqueID);
        }
    </script>

    Hope this will helps you.
    Thanks,
    Shinu.
  6. Chetan
    Chetan avatar
    13 posts
    Member since:
    Sep 2012

    Posted 05 Dec 2013 Link to this post

    Thanks but this means I have to impletement OnClientInitialize1 ,OnClientInitialize2
    OnClientInitialize2,OnClientInitialize3,OnClientInitialize4....one for each RadDock that I have..
    I want to use one function for all the RadDocks which can be spread across 6 RaddockZone?




Back to Top
UI for ASP.NET Ajax is Ready for VS 2017