how to set focus in textbox control inh asp.net using c#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • muskan
    New Member
    • Nov 2006
    • 35

    how to set focus in textbox control inh asp.net using c#

    hello

    I want to set the focus in textbox control.
    I have tried a lot but it is not woking.Tell any property or method for this
    but without setting the tabindex property.

    so how it will be possible .
  • Rathorevivek
    New Member
    • Dec 2006
    • 17

    #2
    Hi once again,
    your problems are very small but interesting ones.
    here is the javascript that will help you:
    document.forms[Form1].elements["txtbox1"].focus();

    Be Happy.

    Vivek Rathore.

    Originally posted by muskan
    hello

    I want to set the focus in textbox control.
    I have tried a lot but it is not woking.Tell any property or method for this
    but without setting the tabindex property.

    so how it will be possible .

    Comment

    • kenobewan
      Recognized Expert Specialist
      • Dec 2006
      • 4871

      #3
      Or you can use page.setfocus in the code behind if you don't want to use JS...

      Comment

      • muskan
        New Member
        • Nov 2006
        • 35

        #4
        hello,

        I have written a code like that

        <script type="text/javascript">
        document.forms[form1].items["txtcustid"].

        actually It is showing items instead of elements & also after writing the textbox name not showing focus method.




        Originally posted by Rathorevivek
        Hi once again,
        your problems are very small but interesting ones.
        here is the javascript that will help you:
        document.forms[Form1].elements["txtbox1"].focus();

        Be Happy.

        Vivek Rathore.

        Comment

        Working...