Ed
asked on
DetailsView Problem
I have 2 button which run the same sub.
One in a details view and one outside the details view.
The button outside the details view runs the code fine and displays the indented message in the label and pops the modal.
The button inside the details view pops the modal but does not populate the label
What's the difference?
Private Sub SubChechAppDate()
Part of the code that won't work with button inside detailsview.
One in a details view and one outside the details view.
The button outside the details view runs the code fine and displays the indented message in the label and pops the modal.
The button inside the details view pops the modal but does not populate the label
What's the difference?
Private Sub SubChechAppDate()
If Session("Rebook") = "Rebook" Then
Dim conn3 As SqlConnection
Dim com3 As SqlCommand
Dim objDR3 As SqlDataReader
Dim connectionString3 As String = ConfigurationManager.ConnectionStrings("IRISConnectionString").ConnectionString
conn3 = New SqlConnection(connectionString3)
com3 = New SqlCommand()
com3.Connection = conn3
com3.CommandType = CommandType.StoredProcedure
com3.CommandText = "ValidateRebooking"
com3.Parameters.Add("@EventID", SqlDbType.Int).Value = GVCurrentAppointments.SelectedDataKey.Values("EVENTID").ToString().Trim()
com3.Parameters.Add("@NEWDATE", SqlDbType.DateTime).Value = Convert.ToDateTime(DirectCast(dvInsertApt.FindControl("txtAptStartDate"), TextBox).Text).[Date]
conn3.Open()
objDR3 = com3.ExecuteReader()
While objDR3.Read()
lblMessage.Text = objDR3("VALID")
lbNextApt.Text = objDR3("nextapt")
'lbNextApt.Text = objDR3("NEXTAPT")
'lblMessage.Text = GVCurrentAppointments.SelectedDataKey.Values("EVENTID").ToString().Trim()
'lbNextApt.Text = dvInsertApt.FindControl("txtAptStartDate")
If objDR3("VALID") = 0 Then
lbNoBook.Text = "You cannot make a rebooking on " + Convert.ToDateTime(DirectCast(dvInsertApt.FindControl("txtAptStartDate"), TextBox).Text).[Date] + "." + " " + "Please try a new date but it must be before" + " " + objDR3("nextapt")
Else
lbNoBook.Text = "you should not see this...."
End If
End While
objDR3.Close()
conn3.Close()
Session("appStartDate") = Convert.ToDateTime(DirectCast(dvInsertApt.FindControl("txtAptStartDate"), TextBox).Text).[Date]
mp1.Show()
End If
Part of the code that won't work with button inside detailsview.
If objDR3("VALID") = 0 Then
lbNoBook.Text = "You cannot make a rebooking on " + Convert.ToDateTime(DirectCast(dvInsertApt.FindControl("txtAptStartDate"), TextBox).Text).[Date] + "." + " " + "Please try a new date but it must be before" + " " + objDR3("nextapt")
Else
lbNoBook.Text = "you should not see this...."
End If
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER