Click here to Skip to main content
15,896,467 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,

i am working in asp.net with c# i used in
XML
<asp:TextBox ID="txtEmpCode" runat="server" Width="180px" AutoPostBack="true" Text='<%#Eval("empl_code") %>'
                                                                       Style="text-transform: uppercase" OnTextChanged="txtEmpCode_TextChanged"></asp:TextBox>




and my recuriment is that when i page in open cursor set in first text box,and then i press tab key its shift and shift other, and when i click save button click my data is save and my cursor is shift first text box,

but my probel is that my all test box autopostback properites is true and its text change i perform some activity, thats by i lost the cursor,


please help me its urgent please
Posted
Comments
Thomas ktg 13-Sep-13 6:59am    
Have you tried setting the cursor focus at runtime?

You have all text boxes with AutoPostBack=True, but Why?
If its the requirement and its happening on your page then you are handling each textbox's textchange event handler and you already know which text box is should have the cursor after postback. You can use javascript to set the focus. Just create a function which registers client script using Page.RegisterClientScriptBlock.
Javascript functions example:
http://stackoverflow.com/questions/45827/how-do-you-automatically-set-the-focus-to-a-textbox-when-a-web-page-loads[^]
 
Share this answer
 
Comments
rajan_gupta 13-Sep-13 7:03am    
i need the AutoPostBack=True, because if it false textchange properites is not working, and how i use i java scrit i used in my application
Hi,

On your save button code add this:
C#
protected void BtnSave_Click(object _ObjSender, EventArgs e)
      {
          try
          {
           TxtFirstTextBox.Focus();
          }
          catch
          {

          }
      }
 
Share this answer
 
Comments
rajan_gupta 14-Sep-13 1:02am    
its not working, i already try this

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900