SetFocus on a specific cell in datagrid

G

Guest

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

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top