in

CodeSmith Community

Your Code. Your Way. Faster!

Re-populating the multiview form after the insert fail on validations

Last post 07-13-2007 9:02 AM by Don. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 04-17-2007 8:19 AM

    • zainuddin
    • Not Ranked
    • Joined on 03-27-2007
    • Posts 8
    • Points 160

    Re-populating the multiview form after the insert fail on validations

    Hi There,

    I am very new to .net tiers, Can any one help me out to sort this problem:

    I have a form with some business logic validation.

    I want my form to re-populate the original values typed in by user after it fails the business validation.

    At the moment the validation messages are displayed but the form is blank. i.e the user has lost the values typed in..

    Thanks for your help.

    Regards,

    Zainuddin.

    zainuddin
    Filed under: , , ,
    • Post Points: 35
  • 04-22-2007 3:07 PM In reply to

    • mike123
    • Top 10 Contributor
    • Joined on 02-25-2005
    • Toronto, Ontario
    • Posts 723
    • Points 16,775

    Re: Re-populating the multiview form after the insert fail on validations

    Zainuddin,

    Have you tried the following (see in bold):

        protected void FormView1_ItemInserted(object sender, FormViewInsertedEventArgs e)
    {
    if (e.Exception != null)
    {
    // handle exeption
    		...
    e.KeepInInsertMode = true; // keep form editing
    }
    }

     

    Mike Shatny
    -------------------------------------
    Member of the .netTiers team
    http://www.nettiers.com
    -------------------------------------
    • Post Points: 65
  • 04-23-2007 3:42 AM In reply to

    • zainuddin
    • Not Ranked
    • Joined on 03-27-2007
    • Posts 8
    • Points 160

    RE: Re-populating the multiview form after the insert fail on validations

    Message
    Thanks mike.
    It worked.
     
    Regards,
    Zainuddin.
    -----Original Message-----
    From: nettiers.support@codesmithsupport.com [mailto:nettiers.support@codesmithsupport.com] On Behalf Of mike123
    Sent: 22 April 2007 21:07
    To: Jawadwala, Zainnudin
    Subject: Re: [.netTiers General Support] Re-populating the multiview form after the insert fail on validations

    Zainuddin,

    Have you tried setting

        protected void FormView1_ItemInserted(object sender, FormViewInsertedEventArgs e)
    {
    if (e.Exception != null)
    {
    // handle exeption
    		...
    e.KeepInInsertMode = true; // keep form editing
    }
    }

     




    * Please Note : This message was received from the Internet *
    _____________________________________________________________
    
    __________________________________________________________________
    
    
    This message might contain confidential information. If it has been sent to you in error please do not forward it or copy it or act upon its contents, but report it to postmaster@schroders.com
    
    Schroders has the right lawfully to record, monitor and inspect messages between its employees and any third party. Your messages shall be subject to such lawful supervision as Schroders deems to be necessary in order to protect its information, its interests and its reputation.
    
    Schroders prohibits and takes steps to prevent its information systems from being used to view, store or forward offensive or discriminatory material. If this message contains such material please report it to abuse@schroders.com
    
    Schroders does not normally accept or offer business instructions via email unless prior agreements are in place. Any action that you might take upon this message might be at your own risk.
    
    
    
    Schroder Investment Management Limited
    31 Gresham Street
    London EC2V 7QA
    
    Authorised and regulated by the Financial Services Authority. Schroder Investment Management Limited is entered on the FSA register under the following register number: 119348
    
    Registered Office
    31 Gresham Street
    London EC2V 7QA
    
    Registered number 1893220
    VAT registration number 243 8687 30
    zainuddin
    • Post Points: 5
  • 07-06-2007 1:13 PM In reply to

    • Don
    • Top 100 Contributor
    • Joined on 11-03-2006
    • Posts 47
    • Points 965

    Re: Re-populating the multiview form after the insert fail on validations

    How do you prevent the Object Data Source from doing another select when you want the formview to stay in insert mode? 

    • Post Points: 5
  • 07-10-2007 8:46 AM In reply to

    • Don
    • Top 100 Contributor
    • Joined on 11-03-2006
    • Posts 47
    • Points 965

    Re: Re-populating the multiview form after the insert fail on validations

     The Keep in Edit mode simply overrides the FormView's default behavior of putting the FormView into it's default mode (i.e. Insert mode returns to ReadOnly mode).  It doesn't do anything as far as retaining a user's updated data, which hasn't yet been saved to the database because of server-side validation failures.

    • Post Points: 5
  • 07-13-2007 9:02 AM In reply to

    • Don
    • Top 100 Contributor
    • Joined on 11-03-2006
    • Posts 47
    • Points 965

    Re: Re-populating the multiview form after the insert fail on validations

     I've figured this out.  I solved the problem by throwing an exception from the BLL.  That's the only way you can get the FormView to keep the values.  I've posted about it in detail here.

    • Post Points: 5
Page 1 of 1 (6 items)
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems