SetFocus Problem ASP.NET_AJAX_2010_1_309

13 posts, 0 answers
  1. Jorge Cardenas
    Jorge Cardenas avatar
    12 posts
    Member since:
    Jan 2010

    Posted 13 Apr 2010 Link to this post

    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

  2. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 14 Apr 2010 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jorge Cardenas
    Jorge Cardenas avatar
    12 posts
    Member since:
    Jan 2010

    Posted 14 Apr 2010 Link to this post

    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.

     

     

     

     

  5. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 19 Apr 2010 Link to this post

    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.
  6. Roger Barnes
    Roger Barnes avatar
    38 posts
    Member since:
    May 2008

    Posted 03 Nov 2010 Link to this post

    This same problem still exist in 2010_2_929, IE8

  7. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 09 Nov 2010 Link to this post

    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
  8. Roger Barnes
    Roger Barnes avatar
    38 posts
    Member since:
    May 2008

    Posted 09 Nov 2010 Link to this post

    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


     

     

     

  9. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 15 Nov 2010 Link to this post

    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
  10. Roger Barnes
    Roger Barnes avatar
    38 posts
    Member since:
    May 2008

    Posted 15 Nov 2010 Link to this post

    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?
  11. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 15 Nov 2010 Link to this post

    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
  12. Roger
    Roger avatar
    38 posts
    Member since:
    May 2008

    Posted 08 Jul 2011 Link to this post

    Is anyone else still having this same issue besides me.

    Regardless of what I do, it doesn't work.
  13. Alex
    Alex avatar
    5 posts
    Member since:
    May 2008

    Posted 27 Jul 2011 Link to this post

    Yes, I have the same issue with version 2011.1.519.35.

    Alex Aisen.
  14. Niko
    Admin
    Niko avatar
    387 posts

    Posted 29 Jul 2011 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017