0

Hi guys,
I am using a details view control for users to enter leave details, I have set some conditions of which if the user does not meet them then a label is displayed to tell him/her what the problem is.
But after displaying the label, I realized that the information is still entered in the table. I have tried closing the connection, exiting the sub but both are not working.
What should I do?

If days <= 1 Then
            Label3.Visible = True
            lvconn.Close()
            Exit Sub
        ElseIf days >= 30 Then
            Label4.Visible = True
            lvconn.Close()
            Exit Sub
        Else
            Response.Redirect("Leave_details.aspx")
        End If
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by Fortinbra
0

You test is being done after the details view is posting to the server, which in turn is posting things into the database. You'll need some form of test before the postback, or to manually handle the database access. You could do a custom validator on the client side, or some javascript. Otherwise, you could handle all your database calls directly from your codebehind, making the use of the asp.net data access control nearly useless to you.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.