Focus in Datagrid not working

P

Purdy

http://aspnet.4guysfromrolla.com/articles/090902-1.aspx
I have used this and double checked my work and it isn't working for
me! uggh!

what am i doing wrong?
the error i get is : 'Form1.MyDataGrid__ctl6_TxtDiscPct' is null or
not an object.

i am using frames, does that matter at all? thx for any help.


Here is my code:

Sub MyDataGrid_Edit(ByVal s As Object, ByVal e As
DataGridCommandEventArgs)
MyDataGrid.EditItemIndex = e.Item.ItemIndex

Dim ds As DataSet
ds = CType(Session("GlobalDataGrid"), DataSet)
MyDataGrid.DataSource = ds
MyDataGrid.DataBind()

Dim tb As TextBox
tb = MyDataGrid.Items(e.Item.ItemIndex).Cells(3).FindControl
"TxtDiscPct")


RegisterStartupScript("focus", "<script
language=""JavaScript"">" & vbCrLf & _
vbTab & "Form1." & tb.ClientID & ".focus();" & _
vbCrLf & vbTab & "Form1." & tb.ClientID & ".select();" &
_
vbCrLf & "<" & "/script>")
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top