Learn how to a build a cloud-first strategyRegister Now


how to display confirmation data in formview prior to insert

Posted on 2008-11-19
Medium Priority
Last Modified: 2013-11-26
We're using ASP.NET 2.0 FormView control wrapped by a web user control to handle CRUD UI operations.  It works well except for confirmation PRIOR to insert or update.  All the links I find on "confirmation" are the response.redirect type after the insert has been made to database.  I need to display the data to user one last time prior to insert.

Formview does not appear to have a mechanism for displaying a readonly template of insert/update data PRIOR to insert/update.  

Tried Me.fvAccountCC.ChangeMode(FormViewMode.ReadOnly) but user input from viewstate doesn't appear in this mode

I'm not good enough yet w/ ADO/XML to extract insert/update data as DataTable and use as datasource for new instance of user control/Formview in readonly view in confirmation page.

Any ideas before I start messy marshalling of user input to duplicate controls in <EmptyDataTemplate> using .FindControl across two instances of usercontrol/formview
  Public Sub SetConfirmTemplate(ByVal Src As ctlAccountCC)
        Me.fvAccountCC.DataSourceID = Nothing
        CType(Me.fvAccountCC.FindControl("lblAccountName"), Label).Text = CType(Src.FormView.FindControl("txtAccountNo"), TextBox).Text
        CType(Me.fvAccountCC.FindControl("lblAccountNo"), Label).Text = CType(Src.FormView.FindControl("txtAccountNo"), TextBox).Text
        CType(Me.fvAccountCC.FindControl("imgCardType"), Image).ImageUrl = CType(Src.FormView.FindControl("imgCardType"), Image).ImageUrl


Question by:mstanley67
1 Comment
LVL 10

Accepted Solution

GeoffSutton earned 2000 total points
ID: 23147856
Set the formview.enabled=false.  Then create a panel object with the confirm text.  The accept button on the panel will be the actual update code, the cancel button will hide the panel and enable the formview again.  One thing I ahve found doing this is that it is much simpler to create a class, then when making the panel visble, set the cssclass of the panel.  That makes editing thepage much simple, since if you set the location in the style for the panel it makes it difficult to edit the page.  
In the panel you can create whatever kind of confirmation dialog you want.
Another option you may want to investigate is the ajax control toolkit (http://www.asp.net/ajax/) which has a "ModalPopupExtender" control.  I have never had much luck with it, preferring to create my own, but it is there for you to use.
Good luck.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month20 days, 22 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question