|
-
May 19th, 2003, 11:50 PM
#1
Thread Starter
New Member
setting focus in a textbox within a datagrid
I would like to have the code to set focus in a textbox within a datagrid on the click of a button which is outside the datagrid. I have written a code which does not work. Please give me the solution.
The following is the error which occurs.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. The error is on the following line
Txtfocus = CType(GrdDailyDropout.FindControl("TxtSlip_No"),Textbox).Text
Public Sub Display(S as Object, E as EventArgs)
Dim Gritem as DataGridItem
Dim Txtfocus as String
If CheckValidity = True Then
Call DisplayRecordMatch()
Call Fill_Grid()
For each Gritem in GrdDailyDropout.Items
Txtfocus = CType(GrdDailyDropout.FindControl("TxtSlip_No"),Textbox).Text
Response.write(Txtfocus & "<br>")
Next
'Dim scriptString as String = "<script language=JavaScript>"
' scriptString += "" & Txtfocus.ClientID & ".focus();<"
' scriptString += "/"
' scriptString += "script>"
' RegisterStartupScript ("clientScript", scriptString)
End if
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|