The CancelButton.Visible = False in the code I attach does not work after a post back.
Could you tell me why?
I've checked in debug mode and the property is being set at all times! (When I hover the mouse over I can see that CancelButton.Visible = False) But it only works the first time.
The reason the form reloads is because every time the insert fails it shows the exception message.
Thanks in advance.
Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
If String.IsNullOrEmpty(Page.Request.QueryString("UserName")) Then
Dim CancelButton As Control = UserDetailsView.FindControl("CancelButton")
CancelButton.Visible = False