find control within itemtemplate client side

5 posts, 0 answers
  1. Frank
    Frank avatar
    16 posts
    Member since:
    Oct 2011

    Posted 06 Jan 2014 Link to this post

    Is there a method for the client side so that I can access the control within the itemtemplate in lightbox item?  I have asp label (or I can use radtextbox) inside of the lightbox itemtemplate and need to change value.

    Thank you!

  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 06 Jan 2014 Link to this post

    Hi Frank,

    Please have a look into the following code snippet to access the ItemTemplate control of RadLightBox from client side.

    ASPX:
    <telerik:RadLightBox ID="CodeLightBox" runat="server" Width="1000px" Modal="true"
        Height="200px">
        <ClientSettings>
            <AnimationSettings HideAnimation="Resize" NextAnimation="Fade" PrevAnimation="Fade"
                ShowAnimation="Resize" />
        </ClientSettings>
        <Items>
            <telerik:RadLightBoxItem>
                <ItemTemplate>
                    <telerik:RadTextBox ID="RadTextBox1" runat="server" CssClass="demo">
                    </telerik:RadTextBox>
                </ItemTemplate>
            </telerik:RadLightBoxItem>
        </Items>
    </telerik:RadLightBox>

    JavaScript:
    <script type="text/javascript">
        function OpenCodeLightBox() {
            var lightBox = $find('<%=CodeLightBox.ClientID %>');
            lightBox.show();
            var Text = lightBox.get_element().getElementsByClassName("demo");
            Text.CodeLightBox$RadTextBox1.control.set_value("new value");
        }
    </script>

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Frank
    Frank avatar
    16 posts
    Member since:
    Oct 2011

    Posted 07 Jan 2014 Link to this post

    Thank you Princy!  I did not see the get_element() in the online documentation.  
  5. Eduardo
    Eduardo avatar
    1 posts
    Member since:
    Dec 2011

    Posted 23 Apr 2015 Link to this post

    How do I access a template radlightbox in C # instead of the script below: 

    <script type="text/javascript">    function OpenCodeLightBox() {        var lightBox = $find('<%=CodeLightBox.ClientID %>');        lightBox.show();        var Text = lightBox.get_element().getElementsByClassName("demo");        Text.CodeLightBox$RadTextBox1.control.set_value("new value");    }</script>

     

    Tanks.

  6. Angel Petrov
    Admin
    Angel Petrov avatar
    1007 posts

    Posted 28 Apr 2015 Link to this post

    Hello,

    If you want to access the RadLigthtBox you can do this directly by using its ID. However if you want to access the RadTextBox inside the ItemTemplate of the first item you can do something like this.

    C#:
    RadTextBox textBox1=CodeLightBox.FindControl("RadTextBox1") as RadTextBox;


    Regards,
    Angel Petrov
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

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