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

SetFocus Problem ASP.NET_AJAX_2010_1_309

12 Answers 153 Views
FormDecorator
This is a migrated thread and some comments may be shown as answers.
Jorge Cardenas
Top achievements
Rank 2
Jorge Cardenas asked on 13 Apr 2010, 06:11 PM

When using the RadFormDecorator I have problems setting the focus to the main control on a page. The problem seems to be in IE 8 because Firefox works correctly. Does anyone have a fix or a workaround?

 

Thanks

12 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 14 Apr 2010, 02:45 PM
Hi Jorge,

How do you set the focus? Could you please paste your code here?

Best wishes,
Georgi Tunev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Jorge Cardenas
Top achievements
Rank 2
answered on 14 Apr 2010, 03:41 PM
Hello Georgi, I have tried a lot of ways. The current way that I am using that works in Mozilla but not in IE 8 is:
Page.SetFocus(
txtName);

I have also tried  txtName.Focus();

I currently set the focus in the code behind pages on PageLoad or when an event occurs.

Thanks.

 

 

 

 

0
Georgi Tunev
Telerik team
answered on 19 Apr 2010, 12:52 PM
Hello Jorge,

Thank you for bringing this problem to our attention. It seems that the problem exists when the decorator is set to style asp:textboxes. I logged this issue in our PITS and we will do our best to fix it for the Q2 release. I updated your points as well.

For the time being I suggest to set the focus on the client with a small timeout - a timeout of 0ms would do the trick as well:


<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
 
<script type="text/javascript">
    function pageLoad()
    {
        window.setTimeout(function()
        {
            var txt = $get("<%= txt1.ClientID %>");
            txt.focus();
        }, 0);
    }
</script>
 
<telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" DecoratedControls="All" />
<asp:TextBox ID="txt1" runat="server"></asp:TextBox>
<br />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<br />
</form>




All the best,
Georgi Tunev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Roger Barnes
Top achievements
Rank 1
answered on 03 Nov 2010, 03:28 PM
This same problem still exist in 2010_2_929, IE8

0
Georgi Tunev
Telerik team
answered on 09 Nov 2010, 09:57 AM
Hi Roger,

What exactly is your setup? I am asking this because I was not able to reproduce the problem locally (see attached video). If you still experience problems, please open a support ticket and send us a sample project so we can investigate further.

Kind regards,
Georgi Tunev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Roger Barnes
Top achievements
Rank 1
answered on 09 Nov 2010, 11:09 PM

I created a little sample project, but wasn't able to upload a zip.

I'll add here.

TestFocus.master, NO codebehind

<%@ Master Language="VB" AutoEventWireup="false" CodeBehind="TestFocus.Master.vb" Inherits="TestFocus.TestFocusMaster" %>
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<head id="Head1" runat="server">
    <title></title>
  
      
  
    <link id="Link1" href="~/Styles.css" rel="Stylesheet" type="text/css" runat="server" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server">
    </telerik:RadStyleSheetManager>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    </telerik:RadAjaxManager>
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server">
    </telerik:RadSkinManager>
    <telerik:RadWindowManager EnableEmbeddedSkins="true" ID="RadWindowManager1" runat="server"
        Behavior="Default" InitialBehavior="None" EnableViewState="true" DestroyOnClose="true"
        Behaviors="Close, Resize, Maximize, Move" ShowContentDuringLoad="true">
        <Windows>
            <telerik:RadWindow runat="server" Behavior="Close" InitialBehavior="None" Left=""
                Top="" ID="Features" Behaviors="Close, Resize, Maximize, Move" Height="400" Modal="True"
                VisibleStatusbar="false" Width="1000px" DestroyOnClose="false" ShowContentDuringLoad="true"
                ReloadOnShow="True" Animation="None" NavigateUrl="">
            </telerik:RadWindow>
        </Windows>
    </telerik:RadWindowManager>
      
    <telerik:RadFormDecorator ID="RadFormDecorator2" DecoratedControls="All" runat="server"
        DecorationZoneID="ZoneID1"></telerik:RadFormDecorator>
    <div style="height: 100%;">
        <div id="ZoneID1" style="height: 100%;">
            <telerik:RadAjaxPanel ID="PagePanel" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">
                <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
                </asp:ContentPlaceHolder>
            </telerik:RadAjaxPanel>
        </div>
    </div>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" HorizontalAlign="Center"
        Skin="Default">
    </telerik:RadAjaxLoadingPanel>
    </form>
</body>
</html>


Default.aspx
<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/TestFocus.Master" CodeBehind="Default.aspx.vb" Inherits="TestFocus._Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    TextBox1: <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
   <br />
   TextBox2: <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</asp:Content>

Default.vb
Partial Public Class _Default
    Inherits System.Web.UI.Page
  
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  
  
        'Neither method works with formdecorator DecoratedControls="All"
        Me.Page.SetFocus(Me.TextBox1)
  
        ScriptManager.GetCurrent(Me.Page).SetFocus(Me.TextBox1.ClientID)
    End Sub
  
End Class


 

 

 

0
Georgi Tunev
Telerik team
answered on 15 Nov 2010, 10:25 AM
Hello Roger,

I tried your code and still, everything works as expected - I attached a video showing my test.
If you still experience problems, please send a ticket (you could use the General Feedback type) with a sample project and a reference to this forum thread. I will check it right away.

Regards,
Georgi Tunev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Roger Barnes
Top achievements
Rank 1
answered on 15 Nov 2010, 03:47 PM
Interesting, what version of telerik are you using, I'm on 2010.2.929.35

Can you post your entire project as a zip, so I can try it locally to see if it works for me?
0
Georgi Tunev
Telerik team
answered on 15 Nov 2010, 03:52 PM
Hi Roger,

I was testing with .NET 3.5 and 4.0 versions of the RadControls for ASP.NET AJAX Q3 2010 SP2 release (2010.2.929.xx).


All the best,
Georgi Tunev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Roger
Top achievements
Rank 1
answered on 08 Jul 2011, 06:13 PM
Is anyone else still having this same issue besides me.

Regardless of what I do, it doesn't work.
0
Alex
Top achievements
Rank 1
answered on 28 Jul 2011, 01:08 AM
Yes, I have the same issue with version 2011.1.519.35.

Alex Aisen.
0
Niko
Telerik team
answered on 29 Jul 2011, 11:37 AM
Hi Alex,

Did you experience the issue with the code provided in this forum thread, or with another implementation? Currently, as my colleague Georgi has already demonstrated, we cannot reproduce this issue on our side. The behavior that we are experiencing is the same as shown in the video, previously attached in this forum thread.
In order to be of help in investigating this issue to the full extend I will need more information what is going on and what setup is producing this error. Common suggestions for such cases are for you to check that there are no JavaScript errors on the page and that the focus code is rendered on the page. Look for a call to the WebForm_AutoFocus method at the end of the rendered page.

Hope this helps.

Greetings,
Niko
the Telerik team
Explore the entire set of ASP.NET AJAX controls we offer here and browse the myriad online demos to learn more about the components and the features they incorporate.
Tags
FormDecorator
Asked by
Jorge Cardenas
Top achievements
Rank 2
Answers by
Georgi Tunev
Telerik team
Jorge Cardenas
Top achievements
Rank 2
Roger Barnes
Top achievements
Rank 1
Roger
Top achievements
Rank 1
Alex
Top achievements
Rank 1
Niko
Telerik team
Share this question
or