The ASP.NET FormView WebControl is one of the most useful items you can find in the Microsoft Visual Studio .NET Toolbar, now, although is extremely easy to use, you can make mistakes and walk in circles just because you forgot a simple click, especially when using the DefaultState property.
This property defines the “default” state for the webcontrol after an insert/update/delete operation, that is, the state to wich the control will return after any of those operations are perfomed. So, the property DOES NOT CHANGE the current FormView’s state, to do that use the ChangeState method instead. Check this c# code:
//Sets the default mode after a delete/insert/update operation
FormView1.DefaultMode = FormViewMode.ReadOnly;
//This changes the formview's state
FormView1.ChangeMode(FormViewMode.Insert);
A common problem is when you are linking a FormView to a GridView (to do a master-details), if you notice that the behavior is not what you want; check what you are doing with that property. Setting the default value to “ReadOnly” usually works fine. If you need to “change” the state of the FormView because of your programming logic, try the ChangeState method.
Got a Question? Ask.
Ask the community a question about this article:
Frequently Asked Questions
How to manage multiple submit buttons on an asp.net form?
By: beytz | 16-08-2008
I have an asp.net form with multiple text boxes.Also, in this form I have several submit buttons.
I want to activate the submit button according to the text box I was in while pressing it... how do I do that?
User and Permission
By: Le Tri Dung | 18-06-2008
How to creat user and permission in asp.net 2.0 (c#)?Can you tell me?Thanks!
Accessing session objects size?
By: Istarion | 03-06-2008
I guess that's not possible but I'll try... Is there a way to view the objects in memory in the current asp.net session and the size of them??That would be great.And it's possible to use sos.dll during execution to print objects sizes?? Thanks in advance!
How to add e-mail verification?
By: beytz | 27-05-2008
Hello,I'm building an asp.net web site.How do I add to my sign up page e-mail verification?
What is c#
By: pradeepbaloni | 20-05-2008
what is c#
I need to implement bulk mailing on my site
By: vijen | 25-04-2008
m developing a site using asp.net, I need to implement bulk mailing on my site for my users informing them about new offers.... How can I do that?????
Q&A Powered by:
Latest Programming Articles
Cool Desktop Wallpapers
By: Danny | 18/11/2008
Cool desktop wallpaper is accomplishments arrangement that displayed in the computer operating system. The wallpapers usually be acclimated in JPEG, BMP and GIF book formats. That wallpaper can be acclimated with Microsoft Windows, Linux and Macintosh Mac OS. Each adviser can be altered requirements, alike admitting wallpaper images advised for accepted monitors can be scaled up or bottomward to the fit size. Those are accessible on the internet for free. Some categories of wallpapers are a
Tips for Buying Software Online
By: Daniel Jowssey | 17/11/2008
Buying software online not only helps save the planet, it also has other benefits, including:
* Ease and Simplicity. You can purchase software in your underwear at 4am if you really want to. Shopping online doesn’t have to be done within regular business hours, nor do you need to look your best to do it. It’s also easy to shop around for the best prices and takes less time than driving to the shops.
Mvc Design Pattern
By: TuVinhSoft .,JSC | 14/11/2008
Model-view-controller (MVC) is an architectural pattern used in software engineering. In complex computer applications that present a large amount of data to the user, a developer often wishes to separate data (model) and user interface (View) concerns, so that changes to the user interface will not affect data handling, and that the data can be reorganized without changing the user interface.
Advantages of Low Cost Contract Programmers in Freelance Programming
By: Joanna Gadel | 12/11/2008
It observed that web industry is getting tougher thus the necessity of freelance contract programmer is required for developing more effective website with flexible features. This article states the fruitful advantages of freelance programmers in contract programming.
A Guide to Cnc Kits
By: Martin Applebaum | 09/11/2008
CNC kits are a way in which to construct your CNC machine. This article will provide some information on these machines.
A Guide to Cnc Tube Bending Machines
By: Martin Applebaum | 08/11/2008
Are you familiar with a CNC tube bending machine? This article will shed some light on the main function and components of this machine.
Ways to Hire Dedicated Php Programmers
By: Jucick | 08/11/2008
It’s not at all easy to hire dedicated PHP programmers unless you know where and how to find them. Whether you need to fix, update or enhance your website you naturally want the job done quick and right.
Top 4 Reasons Why Addressing Web Accessibility is Important
By: Matt Cave | 05/11/2008
There are very high chances that web accessibility is more important to the performance of your web site than you realize. Article takes a look at the top 4 reasons why it would be important to address the issue of web accessibility.