View Single Post
  #6 (permalink)  
Old May 3rd, 2011, 05:24 AM
Phil Critchley Phil Critchley is offline
Authorized User
 
Join Date: Feb 2011
Posts: 37
Thanks: 8
Thanked 0 Times in 0 Posts
Default Additional Comments

Hi Imar

I forgot to mention I have a second buttonfield control on my gridview which I need to display completely different messages to the user depending on the evaulation of an IF statement, see below.

Code:
If (e.CommandName = "Loan") Then

            ' Retrieve the row index stored in the CommandArgument property.
            Dim index As Integer = Convert.ToInt32(e.CommandArgument)

            ' Retrieve the row that contains the button from the Rows collection.
            Dim row As GridViewRow = GridViewReservations.Rows(index)
            PublicationID = row.Cells(0).Text

            ' Retrieve the row that contains the button from the Rows collection.
            Dim rowOne As GridViewRow = GridViewReservations.Rows(index)
            PubTitle = rowOne.Cells(1).Text

            ' Retrieve the row that contains the button from the Rows collection.
            Dim rowTwo As GridViewRow = GridViewReservations.Rows(index)
            Status = rowTwo.Cells(2).Text

            If Status = "Available for Loan" Then

                Call UpdateDatabase()
                Call UserConfirmation()
                Call CBULoanConfirmation()

                Using myLiteratureCatalogue As New Model1.Literature_Cataloguing_SystemEntities
                    Dim reservationStatus = (From publication In myLiteratureCatalogue.Publications Where publication.PublicationID = (PublicationID) Select publication).First()

                    ' Change the status of the publication.
                    reservationStatus.ReservationID = Nothing
                    reservationStatus.StatusID = (2)

                    myLiteratureCatalogue.SaveChanges()

                End Using

                MESSAGE TO SAY PUBLICATION IS AVAILABLE FOR COLLECTION
                System.Threading.Thread.Sleep(5000)
                Response.Redirect(Request.RawUrl)

            ElseIf Status = "Out on Loan\Reserved for Loan" Or "Out on Loan" Or "Reserved for Loan" Then

                MESSAGE TO SAY PUBLICATION IS NOT AVAILABLE
                System.Threading.Thread.Sleep(5000)
                Response.Redirect(Request.RawUrl)

                Stop

            End If

        End If
Reply With Quote