Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Sub in GridView delete error

Reply
Thread Tools

Sub in GridView delete error

 
 
David
Guest
Posts: n/a
 
      06-23-2006
I am getting "Object reference not set to an instance of an object."
when I try to set the value of a string variable in a OnDelete method of sql
command subroutine. Can anyone help with the syntax? Below is code:

Sub On_Subfile_Deleting(ByVal source As Object, ByVal e As
SqlDataSourceCommandEventArgs)

'Set value of new Subfile text from cell

'Subfile text is contained in the 3rd column (index 2).

Dim strsubfile As String = SubfilesGridView.SelectedRow.Cells(2).ToString()


'Set value of new SeqNo from cell

'SeqNo is contained in the 2nd column (index 1).

Dim strseqno As String = SubfilesGridView.SelectedRow.Cells(1).ToString()


'Run function in DBClass module to delete network subfile folder

LblMsg.Text = DBClass.DeleteSubfolders(strseqno, strsubfile,
CLng(txtFileNumber.Text))

LblMsg.Visible = True


End Sub 'On_Subfile_Updating

Thank you.

David


 
Reply With Quote
 
 
 
 
Jan Hyde
Guest
Posts: n/a
 
      06-27-2006
"David" <>'s wild thoughts were
released on Fri, 23 Jun 2006 17:15:46 -0500 bearing the
following fruit:

>I am getting "Object reference not set to an instance of an object."
>when I try to set the value of a string variable in a OnDelete method of sql
>command subroutine. Can anyone help with the syntax? Below is code:


You'll find slectedrow isn't set on a delete, if you want to
know which row invoked the delete use e.RowIndex

J


>Sub On_Subfile_Deleting(ByVal source As Object, ByVal e As
>SqlDataSourceCommandEventArgs)
>
>'Set value of new Subfile text from cell
>
>'Subfile text is contained in the 3rd column (index 2).
>
>Dim strsubfile As String = SubfilesGridView.SelectedRow.Cells(2).ToString()
>
>
>'Set value of new SeqNo from cell
>
>'SeqNo is contained in the 2nd column (index 1).
>
>Dim strseqno As String = SubfilesGridView.SelectedRow.Cells(1).ToString()
>
>
>'Run function in DBClass module to delete network subfile folder
>
>LblMsg.Text = DBClass.DeleteSubfolders(strseqno, strsubfile,
>CLng(txtFileNumber.Text))
>
>LblMsg.Visible = True
>
>
>End Sub 'On_Subfile_Updating
>
>Thank you.
>
>David
>



Jan Hyde (VB MVP)

--
A pessimist's blood type is always b-negative. (Pun of the Day)

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Death To Sub-Sub-Sub-Directories! Lawrence D'Oliveiro Java 92 05-20-2011 06:50 AM
Recognising Sub-Items and sub-sub items using xslt Ben XML 2 09-19-2007 09:35 AM
what's the differences between "Overrides Sub OnError" and "Sub Page_Error" ? Tee ASP .Net 2 07-09-2004 09:50 AM
Possible to terminate a sub that loads another sub? Kathy Burke ASP .Net 3 11-24-2003 02:01 PM
how do make a pop-up in sub ASP.net sub ? THY ASP .Net 1 08-18-2003 11:30 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57