Monday, March 26, 2012

ListSearchExtender and TAB

Hi

I am beginning to use the ListSearchExtender and it works but only if I press Enter or click with the mouse on selected item; when I the press the TAB and focus leaves the ListSearchExtender and goes to next control the ListSearchExtender returns to first item... must of the users uses the TAB to go to next field/control. How can the ListSearchExtender keep its selected value?

Any solutions?

Thanks!

/Staffan

Smile to make the question a litte bit better; TAB functions well when I am NOT dropping down the dropdown i e it keeps selected value, but if I dropdown the dropdown and then types some valid characters and then press TAB it returns to first item?

Kind Regards

STaffan


Hi,

The item is remained selected when I press tab according to my test.

Please try this sample:

<%@. Page Language="C#" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DropDownList1.DataSource = this.GetWordListText(); DropDownList1.DataBind(); } //string script = ClientScript.GetPostBackEventReference(DropDownList1, ""); //DropDownList1.Attributes.Add("onblur", script); //DropDownList1.Attributes.Add("onchange", script); //Response.Write(DropDownList1.SelectedValue); } public string[] GetWordListText() { string[] tempWordListText = new string[] { "Alfa", "Alpha", "Bravo", "Charlie", "Delta", "Echo", "Foxtrot", "Golf", "Hotel", "India", "Juliett", "Juliet", "Kilo", "Lima", "Mike", "November", "Oscar", "Papa", "Quebec", "Romeo", "Sierra", "Tango", "Uniform", "Victor", "Whiskey", "X-ray", "Xray", "Yankee", "Zulu", "Zero", "Nadazero", "One", "Unaone", "Two", "Bissotwo", "Three", "Terrathree", "Four", "Kartefour", "Five", "Pantafive", "Six", "Soxisix", "Seven", "Setteseven", "Eight", "Oktoeight", "Nine", "Novenine" }; Array.Sort(tempWordListText); return tempWordListText; }</script><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <div> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> </div> <asp:DropDownList ID="DropDownList1" runat="server"> </asp:DropDownList> <ajaxToolkit:ListSearchExtender PromptPosition="Top" ID="ListSearchExtender1" runat="server" TargetControlID="DropDownList1"> </ajaxToolkit:ListSearchExtender> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> </form></body></html>

Hope this helps. If it doesn't, please provide a simple page without relying on any specific DataBase or class.


Hi!

When I am using your code and:

1. Click the downarrow to "downdrop"
2. When I see the beginning of the list and I am typing for example charli and then direct press TAB on my keyboard the dropdown selects Alfa.

?

Best Regards!

Staffan

No comments:

Post a Comment