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. Advertisements

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,558
    Alvin Bruney [MVP]
    Feb 3, 2004
  2. Cory D.
    Replies:
    1
    Views:
    813
    =?Utf-8?B?dGVuemVlbC4=?=
    Jul 28, 2004
  3. Eliyahu Goldin
    Replies:
    1
    Views:
    663
    =?Utf-8?B?dGVuemVlbC4=?=
    Jul 31, 2004
  4. =?Utf-8?B?YW5nc3JhbQ==?=
    Replies:
    1
    Views:
    845
    =?Utf-8?B?dGVuemVlbC4=?=
    Jul 31, 2004
  5. =?Utf-8?B?SmF2?=

    Is ViwState Page-Specific or UserControl-Specific

    =?Utf-8?B?SmF2?=, Aug 16, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    761
    =?Utf-8?B?SmF2?=
    Aug 16, 2006
  6. mazdotnet
    Replies:
    2
    Views:
    557
    Alexey Smirnov
    Oct 2, 2009
  7. Empire City
    Replies:
    3
    Views:
    622
    Empire City
    Apr 30, 2004
  8. RJ
    Replies:
    1
    Views:
    403
    Eliyahu Goldin
    Feb 17, 2005
Loading...