Hi experts
i want to set enter key . . in my webpage i have 35 textboxe's .. in cntrol i moved with TAB key . . but i want to move with also Enter Key . . any suggestion guy . .
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Suthish NairRank #92 · 22.8K reputationPosted Apr 14, 2011, 3:23 AM EDT
refer
Ravishankar SinghRank #669 · 3.6K reputationPosted Apr 14, 2011, 1:48 AM EDT
Could you please elaborate more?so that we can understand your question with your requirement.
Prabhakar PariharRank #1,307 · 1.3K reputationPosted Apr 14, 2011, 3:01 AM EDT
Prabhakar PariharRank #1,307 · 1.3K reputationPosted Apr 14, 2011, 3:29 AM EDT
Brian4 reputationPosted Jun 7, 2011, 9:55 AM EDT
Brian4 reputationPosted Jun 8, 2011, 5:35 AM EDT
I figured out the answer to my question. If you are using a Silverlight Application and want to use the "Enter" key to tab through TextBoxes or Controls you can do something similar to the following:
private void OnKeyDown(object sender, KeyEventArgs e) controls = LayoutRoot.Children().Where(x => x.GetType().Name == "TextBox" || x.GetType().Name == "ComboBox").OrderBy(y => y.TabIndex).ToList();
{
if (e.Key == Key.Enter)
{
List
int indx = controls.IndexOf(e.OriginalSource as Control);
if (indx < 0 && e.OriginalSource == btn && e.Key == Key.Enter) { // Do what you need here; // return; }
if (indx + 1 >= controls.Count) { btn.Focus(); }
else { controls[indx + 1].Focus(); }
}
// Another additional add on you could use is to implement what the "Esc" key press will do as seen below
if (e.Key == Key.Escape) { // Do what you need here; }
}
In my example I am not only using the "Enter" key to simulate a "Tab" key press, I am also counting the Controls so that when the last control is hit the "Enter" key press takes you to an "OK" button and pressing "Enter" again will click the "OK" button thus submitting a form, login control, etc.