SetFocus on a specific cell in datagrid

Discussion in 'ASP .Net' started by =?Utf-8?B?TXJzTGVpZ2g=?=, Jan 26, 2006.

  1. I have a datagrid on a web page. In the footer there is a field that should
    be recieve the focus, either at the start or after a button is clicked to
    insert the row that is being added in the footer.

    I created the following Sub...

    Private Sub SetFocus(ByVal ctrl As Control)
    Dim SetFocus As String = "<script
    language='javascript'>document.getElementById(""" & ctrl.ClientID &
    """).focus();</script>"
    RegisterStartupScript("SetFocus", SetFocus)
    End Sub

    And when I call it at the end of my ButtonClick event this is what I enter...

    SetFocus(dtgIPAddresses)

    in my HTML This is the entry to the control I want to select....

    <FooterTemplate>
    <asp:TextBox ID="txtIpAddressNew" Runat="server" TabIndex="1" />
    </FooterTemplate>

    I don't know what I need to do in my sub...or elsewhere to achieve this...
     
    =?Utf-8?B?TXJzTGVpZ2g=?=, Jan 26, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. coleenholley
    Replies:
    3
    Views:
    3,438
    Alvin Bruney [MVP]
    Feb 3, 2004
  2. Cory D.
    Replies:
    1
    Views:
    719
    =?Utf-8?B?dGVuemVlbC4=?=
    Jul 28, 2004
  3. John Saunders
    Replies:
    0
    Views:
    421
    John Saunders
    Jul 27, 2004
  4. Eliyahu Goldin
    Replies:
    1
    Views:
    552
    =?Utf-8?B?dGVuemVlbC4=?=
    Jul 31, 2004
  5. =?Utf-8?B?YW5nc3JhbQ==?=
    Replies:
    1
    Views:
    757
    =?Utf-8?B?dGVuemVlbC4=?=
    Jul 31, 2004
Loading...

Share This Page