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

Focus problem -iframe in LightBox control

3 Answers 27 Views
LightBox
This is a migrated thread and some comments may be shown as answers.
Ravindranath reddy
Top achievements
Rank 1
Ravindranath reddy asked on 12 Aug 2014, 01:59 AM
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>

3 Answers, 1 is accepted

Sort by
0
Ravindranath reddy
Top achievements
Rank 1
answered on 12 Aug 2014, 11:39 PM
Any idea guys?
0
Accepted
Angel Petrov
Telerik team
answered on 14 Aug 2014, 12:35 PM
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.

 
0
Ravindranath reddy
Top achievements
Rank 1
answered on 15 Aug 2014, 01:32 AM
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();
                }
Tags
LightBox
Asked by
Ravindranath reddy
Top achievements
Rank 1
Answers by
Ravindranath reddy
Top achievements
Rank 1
Angel Petrov
Telerik team
Share this question
or