Tri Nguyen
Top achievements
Rank 1
Tri Nguyen
asked on 07 Jan 2009, 11:54 PM
Hello, all
I have an app that utilizes the PanelBar as the toolbar on the left-hand side. There are few textboxes, allowing users to enter some text and click one of the PanelBar item to initiate a search. Could you tell me how that I can capture when users hit the Enter key in order to activate the Search procedure? Thanks in advance.
Tri.
I have an app that utilizes the PanelBar as the toolbar on the left-hand side. There are few textboxes, allowing users to enter some text and click one of the PanelBar item to initiate a search. Could you tell me how that I can capture when users hit the Enter key in order to activate the Search procedure? Thanks in advance.
Tri.
4 Answers, 1 is accepted
0
Tri Nguyen
Top achievements
Rank 1
answered on 12 Jan 2009, 11:48 PM
Any help would be greatly appreciated.
0
Hello Tri,
Here is an example:
Best wishes,
Peter
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Here is an example:
| <body onkeydown="CheckKey(event);"> |
| <form id="form1" runat="server"> |
| <asp:ScriptManager ID="ScriptManager1" runat="server"> |
| </asp:ScriptManager> |
| <script type="text/javascript"> |
| function CheckKey() { |
| if (event.keyCode == 13) { |
| var panelbar = $find("<%= RadPanelBar1.ClientID %>"); |
| var panelbarSearchItem = panelbar.findItemByText("Search"); |
| panelbarSearchItem.click(); |
| } |
| } |
| </script> |
| <telerik:RadPanelBar ID="RadPanelBar1" runat="server" OnItemClick="RadPanelBar1_ItemClick"> |
| <CollapseAnimation Type="None" Duration="100"></CollapseAnimation> |
| <Items> |
| <telerik:RadPanelItem runat="server" Text="Search"> |
| </telerik:RadPanelItem> |
| <telerik:RadPanelItem runat="server" Text="Root RadPanelItem2"> |
| </telerik:RadPanelItem> |
| <telerik:RadPanelItem runat="server" Text="Root RadPanelItem3"> |
| </telerik:RadPanelItem> |
| </Items> |
| <ExpandAnimation Type="None" Duration="100"></ExpandAnimation> |
| </telerik:RadPanelBar> |
| <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> |
| </form> |
| </body> |
| protected void RadPanelBar1_ItemClick(object sender, Telerik.Web.UI.RadPanelBarEventArgs e) |
| { |
| if (e.Item.Text == "Search") |
| Response.Write("Searching for '" + TextBox1.Text + "'..."); |
| } |
Best wishes,
Peter
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Tri Nguyen
Top achievements
Rank 1
answered on 13 Jan 2009, 04:21 PM
Thanks for your response. Could you tell me how I can apply the code to the master page?
0
Hello Tri Nguyen,
The same code can be used in a master page as well.
Regards,
Albert
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
The same code can be used in a master page as well.
Regards,
Albert
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.