Set focus and smart navigation

  • Thread starter Thread starter Benny
  • Start date Start date
B

Benny

Hello Experts,

Currently I am writing a web application using vs.net 2002 with c#.

In a customer info page of the application, i have set the smart
navigation to true, so the application can go back to the same position
when postback occurs, and other reasons.
In the customer info page, when the user want to create a new customer
(user click the NEW button), i want the customer name textbox (first
field to enter) is on focus. Therefore the user dont have to hit tab all
the way the textbox. However, since smart nagviation is on, the last
click button (button NEW in this case) will set to focused, not the
customer name textbox i want.

my code is like this:

//c#
labelJavascript.Text =
"<script>setSelectFocus('customername');</script>";

// javascript
function setSelectFocus(field)
{
document.all[field].select();
document.all[field].focus();
}


can someone please tell me how can i overcome this problem?


thanks in advanced,

Benny
 
While you click the NEW button, stored the TextBox name in a hidden field.
When post back the form, find the TextBox name from hidden field and set the
focus to that TextBox using JavaScript coding.

Regards,
Amal
 
Hello AMAL,

I tried your suggstion, but didnt work. Can you please show me the
codes.


Cherrs,

Benny
 
Back
Top