Click here to Skip to main content
15,882,017 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am stuck in a very strange issue that happens in the Chrome browser only.

I have a Silverlight page with a button on it. On clicking that button I want to open an ASPX page with a text box on it having attribute autofocus applied. But whenever I redirect from Silverlight page to ASPX page, the text box is never get focused on Chrome browser. Did anyone face such issue before?

Below are the version information associated

Google Chrome : 41.0.2272.89 m
.NET Framework : 4.5.1
Silverlight : 5.0

Code Snippet Silverlight ( MAIN.XAML File)
XML
<Grid x:Name="LayoutRoot" removed="White">
        <Button Content="Go to Default page" Click="Button_Click" HorizontalAlignment="Left" Margin="161,131,0,0" VerticalAlignment="Top" Width="156"/>

    </Grid>


Code Snippet Silverlight ( MAIN.XAML.CS File )
C#
private void Button_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Browser.HtmlPage.Window.Navigate(new       Uri("Default.aspx", UriKind.Relative));
        }



Code Snippet DEFAULT.ASPX page
XML
<div>
        <asp:TextBox runat="server" ID="txtName" ClientIDMode="Static" autofocus/>
    </div>


Please help
Posted
Updated 15-Mar-15 23:16pm
v2

 
Share this answer
 
Comments
Amit@Bas 16-Mar-15 5:52am    
Thanks for your answer Kornfeld, I tried both of these options after reviewing the above given links but none of them seems to be working for me :(
Kornfeld Eliyahu Peter 16-Mar-15 6:14am    
Can you see what control DOES have the focus? You maybe have more than one in which case the last (in tab order) will have it...
Amit@Bas 16-Mar-15 6:31am    
If I see this in Chrome, then I don't see any control which is having focus on it. In my case I got only single text box on ASPX page. Even if I keep on hitting TAB, none of the control get focus on the page. But when I click on chrome tab then the text box gets focus which is weird. On other browsers it works like charm.
Kornfeld Eliyahu Peter 16-Mar-15 6:35am    
So Chrome itself is out of focus not the text box...Are you saying that other browser got focused in the same situation?
Amit@Bas 16-Mar-15 6:39am    
Yes Kornfeld, exactly this is the problem here. Other browsers make the text box focused in the same scenario except that of Chrome.
Seems like its an existing bug in Google Chrome. Thanks to Kornfeld providing me theread given below.

https://productforums.google.com/forum/#!topic/chrome/EzCB8BXeDxQ[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900