Last post Mar 14, 2013 12:33 AM by asp.netUser
Oct 15, 2007 05:00 PM|john1506|LINK
This is my first asp.net application and it looks like I am in a rock and a hard place.
I have a multi page formview and I want to allow the user to page back with causing validation, but if I don’t cause validation on the page back button, I get an error
Line 42: Protected Sub FormView1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.FormViewPageEventArgs) Handles FormView1.PageIndexChanging
Line 43: FormView1.UpdateItem(True)
Line 44: If FormView1.PageIndex < 1 Then
Line 45: FormView1.FindControl("ImpactsTextBox").Focus()
Sep 13, 2010 12:36 AM|DigitalKnight|LINK
The problem is that you are calling the FormView.UpdateItem() which to execute must call Page.IsValid property which cannot br called before the Page is really validated so here the solution:-
Page.Validate(); // To force validation manually
// Place your code here which will finish the update like FormView.UpdateItem()
I hope it could help you my friend.
Mar 14, 2013 12:33 AM|asp.netUser|LINK
I am trying to do this and my code still goes to the next statement and doesnt stop at the validation point even if the validations fire . Why is that?
FYI - I am creating all my controls dynamically on "oninit"