Link to home
Create AccountLog in
Avatar of fosiul01
fosiul01Flag for United Kingdom of Great Britain and Northern Ireland

asked on

How to redirect page from DetailsView1

HI , i Have atached 2 picture to explain, please have a look. all the code here for DetailsView1 control.

when some one is click on insert button,  it will redirect to another  page.
I have attached the code aswell.

Now if someone dont want to add any data, so they will click on Cancel , so i want to know, if any one click on cancel, how i will redirect the page to another page.

i was checking there are option for inserted (DetailsViewInsertedEventArgs) but not for canceled

any advise would be help full for me.




Protected Sub DetailsView1_ItemInserted(ByVal sender As Object, _
           ByVal e As System.Web.UI.WebControls.DetailsViewInsertedEventArgs) _
           Handles DetailsView1.ItemInserted
        If e.Exception IsNot Nothing Then
            lblError.Text = "Invalid data. Please insert data first and try again."
            e.ExceptionHandled = True
        Else
            Response.Redirect("guestbookview.aspx")
        End If
    End Sub

Open in new window

Cancelcommand1.GIF
Cancelcommand2.GIF
ASKER CERTIFIED SOLUTION
Avatar of Rejojohny
Rejojohny
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of fosiul01

ASKER

Hi Thanks for the answer, yes , its fine.
its working.