Focus problem -iframe in LightBox control

4 posts, 1 answers
  1. Ravindranath reddy
    Ravindranath reddy avatar
    4 posts
    Member since:
    Mar 2010

    Posted 11 Aug 2014 Link to this post

    I have Iframe in lightbox. After loading  focus is missing from text box inside test.aspx page? what to do tog et focus into iframe and to controls in iframe without using mouse. Need solution asap please.

      <telerik:RadLightBox ID="create" runat="server" Modal="true" DescriptionPosition="Top" Width="1024px"   Height="740px"  RenderMode="Lightweight" PreserveCurrentItemTemplates="true" ShowNextButton="false" ShowPrevButton="false" ShowMaximizeButton="true" ShowRestoreButton="true">
            <ClientSettings>
                <AnimationSettings HideAnimation="None" ShowAnimation="None" />
               </ClientSettings>
            
            <Items>

                <telerik:RadLightBoxItem >

                    <ItemTemplate >

                        <div style="height:730px;">
                            <iframe id="Iframe1" frameborder="0" marginwidth="1" src="test.aspx" runat="server" 
                                style="width: 100%; border: solid 1px; padding: 1px; overflow-y: auto; height: 100%;"></iframe>
                        </div>
                         
                        
                    </ItemTemplate>
                </telerik:RadLightBoxItem>
            </Items>
        </telerik:RadLightBox>
  2. Ravindranath reddy
    Ravindranath reddy avatar
    4 posts
    Member since:
    Mar 2010

    Posted 12 Aug 2014 in reply to Ravindranath reddy Link to this post

    Any idea guys?
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Answer
    Angel Petrov
    Admin
    Angel Petrov avatar
    1006 posts

    Posted 14 Aug 2014 Link to this post

    Hello Ravindranath,

    You can try calling the below provided code after displaying the RadLightBox.

    JavaScript:
    var iframe = $telerik.findElement(document, 'Iframe1');
                       iframe.contentWindow.document.getElementById('ElementID').focus();

    Hope the example provided proves helpful.

    Regards,
    Angel Petrov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  5. Ravindranath reddy
    Ravindranath reddy avatar
    4 posts
    Member since:
    Mar 2010

    Posted 14 Aug 2014 in reply to Angel Petrov Link to this post

    Hi Angel, you are correct!!!!! Absolutely works fine your idea.

    Thanks so much Angel.

    But I have changed according to my requirement. I need to focus different controls once light box closed and reopened.

    I need to focus either  text box or button. This is how I implemented.
     lightBox.show();
                    var iframe = $telerik.findElement(document, 'Iframe1');
                    if (iframe.contentWindow.document.getElementById('MainContent_rtxtName').disabled) {
                        iframe.contentWindow.document.getElementById('MainContent_btnNew').focus();
                    }
                    else {
                        
                        iframe.contentWindow.document.getElementById('MainContent_rtxtName').focus();
                    }
Back to Top