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

Unable to set Focus()

12 Answers 421 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 2
Martin asked on 04 Mar 2013, 03:36 PM
If I replace the RadAutoCompleteBox with a normal wpf textbox I can set focus in event OnLoaded with method myTextBox.Focus();
her is the code with the RadAutoCompleteBox that is not working:

<Window x:Class="Propertydesigner.Window1"
        xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
        xmlns:controls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Input"
        Title="Window1" Height="300" Width="300" Loaded="Window1_OnLoaded" >
    <Grid>
        <telerik:RadBusyIndicator Grid.Row="1"  IsIndeterminate="True">
            <Grid HorizontalAlignment="Stretch" Margin="5">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
 
                <StackPanel>
                    <TextBlock Text="Enter a document name" Margin="0 0 0 5"/>
                    <controls:RadAutoCompleteBox  x:Name="SearchForDocuments"
                         DisplayMemberPath ="Name"
                         SelectionMode="Single"
                         TextSearchMode="Contains"                   
                         HorizontalAlignment="Stretch"
                         Margin="0 0 0 3"/>
                </StackPanel>
 
                <StackPanel Grid.Row="2"
                    Orientation="Horizontal"
                    HorizontalAlignment="Right"
                    VerticalAlignment="Center"
                    Margin="0 10 0 0">
                    <telerik:RadButton Content="OK"  Width="70" Margin="0 0 10 0" />
                    <telerik:RadButton Content="Cancel" Width="70"/>
                </StackPanel>
            </Grid>
        </telerik:RadBusyIndicator>
    </Grid>
</Window>


  private void Window1_OnLoaded(object sender, RoutedEventArgs e)
        {
            SearchForDocuments.Focus();
        }


12 Answers, 1 is accepted

Sort by
0
Ivo
Telerik team
answered on 04 Mar 2013, 05:56 PM
Hi Martin,

Thank you for pointing this out.

Actually this issue is known and a fix for it should be included into the next internal build.

Regards,
Ivo
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Subash
Top achievements
Rank 1
answered on 14 Mar 2013, 12:46 PM
Hi,

What is the possible time to release the build which address these issue. This is very urgent for us to close one of our UAT fix.

thanks
Pons
0
Ivo
Telerik team
answered on 15 Mar 2013, 01:20 PM
Hello Subash,

This issue is scheduled for our next official release - Q1 2013 SP1. It will be released at the beginning of next month. Also when an internal build including this one is released I will write in this thread.

I hope this one is suitable for you.

Regards,
Ivo
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Subash
Top achievements
Rank 1
answered on 12 Apr 2013, 05:53 AM
Hi 

Is the  Q1 2013 SP1 got released? If yes Please let us know the link to  download the same.

We are highly dependent on this build due to the customer escalation on focus issue.

thanks
Subbash 
0
Ivo
Telerik team
answered on 17 Apr 2013, 08:19 AM
Hi Subash,

I can confirm that a fix for the mentioned issue is included into the 2013 Q1 SP1. You can download the latest official version of RadControls for WPF here.

All the best,
Ivo
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Navya
Top achievements
Rank 1
answered on 12 Dec 2013, 05:09 PM
2013.2.611.40  is the version that i use .  I cannot set focus on the RadWatermarkTextBox.
0
Kalin
Telerik team
answered on 16 Dec 2013, 12:02 PM
Hello Navya,

I tested the scenario with the mentioned version of the controls and was able to successfully focus the AutoCompleteBox in the Loaded event of the Window.

Could you please give us some more details on your set up and if you are able to share some code that would be really helpful?

Regards,
Kalin
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Trevor
Top achievements
Rank 1
answered on 10 Sep 2014, 03:50 PM
This still seems to be a bug. Setting focus to a RADAutocomplete box. seems to work when the box is empty, but not when It has data in it.

Code snippet
c#

protected void originPort_TextChanged(object sender, AutoCompleteTextEventArgs e)
{
if (originPort.Text != "")
{
Session["ORGCNT"] = originPort.Entries[0].Value.Substring(0, 2);
sendingDataSource.Select(DataSourceSelectArguments.Empty);
sendAgent.DataBind();


destinationPort.Focus();
}
}

protected void destinationPort_TextChanged(object sender, AutoCompleteTextEventArgs e)
{
if (destinationPort.Text != "")
{
Session["DSTCNT"] = destinationPort.Entries[0].Value.Substring(0, 2);
//receivingDataSource.Select(DataSourceSelectArguments.Empty);
//receiveAgent.DataBind();
}

}

--

aspx

<td class="bkBody">
<telerik:RadAjaxPanel ID="RadAjaxPanel4" runat="server" Width="259px" Height="16px" >
<table border="0" cellpadding="2" cellspacing="0" style="width: 100%">
<tr>
<th class="auto-style18">Place of Origin<br />
<asp:CheckBox ID="cb_LoadDisch" runat="server" AutoPostBack="True" OnCheckedChanged="cb_LoadDisch_CheckedChanged" Text="Load/Disch" />
</th>
<td class="auto-style6">
<telerik:RadAutoCompleteBox style="width:200px" ID="originPort" DefaultMessage="Select Origin....." runat="server" DataSourceID="portDataSource" DataTextField="pt_PortName" DataValueField="pt_Code" Width="300" DropDownWidth="300" InputType="Text" Skin="Metro" TextSettings-SelectionMode="Single" OnTextChanged="originPort_TextChanged" TabIndex="66" ShowLoadingIcon="False"> </telerik:RadAutoCompleteBox>
<asp:SqlDataSource ID="portDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:NGENAConnectionString %>"
SelectCommand="SELECT [pt_Code], (LTRIM(RTRIM([pt_PortName])) + ', ' + LTRIM(RTRIM([pt_CountryName])) + ' (' + pt_code + ')') AS pt_PortName FROM [Ports] WHERE [pt_IataCode] <> ''"></asp:SqlDataSource>
<asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" Text="!" ErrorMessage="Origin required." ForeColor="Red" ControlToValidate="originPort" Enabled="true" Font-Bold="true" ></asp:RequiredFieldValidator>
</td>

<th class="auto-style5">Place of Destination</th>
<td class="auto-style6">
<telerik:RadAutoCompleteBox style="width:200px" ID="destinationPort" DefaultMessage="Select Destination.." runat="server" DataSourceID="portDataSource" DataTextField="pt_PortName" DataValueField="pt_Code" Width="300" DropDownWidth="300" InputType="Text" Skin="Metro" TextSettings-SelectionMode="Single" TabIndex="67" ShowLoadingIcon="False" MinFilterLength="2" OnTextChanged="destinationPort_TextChanged" ></telerik:RadAutoCompleteBox>
<%--<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" Text="!" ErrorMessage="Destination required." ForeColor="Red" ControlToValidate="destinationPort" Enabled="true" Font-Bold="true"></asp:RequiredFieldValidator>--%>

</td>
</tr>
<tr>


0
Nencho
Telerik team
answered on 15 Sep 2014, 12:09 PM
Hello Trevor,

We have performed some local tests and it seems that the behavior is correct at our end. Here is a video, demonstrating the local tests. Could you specify which version of our controls that you currently using and the browser under which you are experiencing the issue?


Regards,
Nencho
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Trevor
Top achievements
Rank 1
answered on 17 Sep 2014, 11:33 AM
HI

Unfortunately  your video does not play. Just a white screen.

using IE11, and Chrome.

telerik ctls ver  2014.2.724.40

I can only click in the box, by putting the cursor just at the end of the existing item..but I need to just click ON the item in the box of course. Clicking on the item should highlight, the item, like it does when I click past it, then backspace.

I thought may be I could add an onclientclicking event.. but that's not valid on this control

Help


 
0
Trevor
Top achievements
Rank 1
answered on 17 Sep 2014, 11:39 AM
I did event get your video to work, and I see that you are just doing what is FIDDLY for the user.. ie putting the cursor right at the end of the existing input area.

If it were internal users using the system, maybe I could live with it, but it will be our customers trying to enter information.. and its just too fiddly. if you try and click at the end,, then hit backspace, and get it wrong.. the browser gores back a whole page, potentially losing all the input that has been done on the page. We need to be able to do what is intuitive.. click on the existing entry ANYWHRE in the box so as to select the existing item.

Rgds
Trevor Gall
IT Director Asia Pacific
(special project development consultant assigned to  Sweden)
0
Nencho
Telerik team
answered on 19 Sep 2014, 12:41 PM
Hello Trevor,

As I can see you had submitted a supported ticket, describing the requested functionality, which we have already replied. This is why, I would like to ask you to continue the correspondence in the other thread, in order to avoid duplication.

Regards,
Nencho
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
AutoCompleteBox
Asked by
Martin
Top achievements
Rank 2
Answers by
Ivo
Telerik team
Subash
Top achievements
Rank 1
Navya
Top achievements
Rank 1
Kalin
Telerik team
Trevor
Top achievements
Rank 1
Nencho
Telerik team
Share this question
or