search
Japanese Chinese Nederlands Espanol Italiano Deutsch Francais Twitter Rss Feeds
.NET Framework GroupsView
Deployment Server
.NET Distributed_Apps
.NET
.NET ADO.NET
.NET ASP.NET
.NET ASP.NET Security
.NET ASP.NET Webcontrols
.NET ASP.NET Web Services
.NET Clr
.NET Compact Framework
.NET Drawing
.NET Interop
.NET Micro Porting
.NET Performance
.NET Web Services
.NET Windows Forms
.NET Windows Forms Controls
.NET General
.NET Csharp
.NET Visual Basic
.NET Vc
.NET Security
.NET Xml
Scripting Jscript
Scripting Visual Basicscript
Scripting Wsh
Smartphone Developer
Visual Basic Com
Visual Basic Controls
Visual Basic Crystal
Visual Basic Database Ado
Visual Basic Syntax
Visual Basic Vista Compatibility
Visual Basic Winapi
Vc Atl
Vc Debugger
Vc Language
Vc Mfc
Vc Stl
Visio Developer Visual Basica
Vsnet Debugging
Windows Powershell
Windowsce Embedded Vc
Xml
Xsl

Group SummariesView
.NET Framework
Access
BizTalk
Certifications
CRM
DDK
Exchange Server
FoxPro
French
French .NET
Games
German
German .NET
Graphic Design
IIS
Internet
ISA Server
Italian
Italian .NET
Maps
MCIS
Miscellaneous
Mobile Application Development
Money
MSN
Networking
Office
Ops Mgr
Publisher
Security
SharePoint
Small Business
Spanish
Spanish .NET
SQL Server
Systems Management Server
Transaction Server
Virtual PC / Virtual Server
Visual Studio
Win32
Windows 2000
Windows 2003 Server
Windows 7
Windows Live
Windows Media
Windows Update
Windows Vista
Windows XP
 

View All Microsoft NET ASP NET Posts  Ask A New Question 

DetailsView defaultMode question - Seth Williams

Tuesday, May 06, 2008 12:42 PM

I have a Master/Detail page - the DetailsView is set to ReadOnly, and
AutoGenerates Delete/Edit/Insert buttons
The Gridview has records - when a record is selected, the DetailsView is
populated
I can successfully Delete/Insert/Update - no problem

However, since it's set to ReadOnly, the DetailsView is not visible when no
records are in the Gridview and the corresponding table
I need it to be visible, so I can choose the Insert capabilities, the first
time (once in production)

If I set the DetailsView to Insert for the defaultMode, it never changes
from that mode, even when a record is selected from the Gridview

I tried adding a 'CheckMode' sub, and ran it in the INSERTED and DELETED
events of the DetailsView, along with Page_Load:

If gvTransient.Rows.Count = 0 Then
dvTransient.DefaultMode = DetailsViewMode.Insert
Else
dvTransient.DefaultMode = DetailsViewMode.ReadOnly
End If

However, the defaultmode property apparently is only available when the page
initially loads, and can not be changed not on postback

Is there any other way I can achieve what I'm needing?
reply

Previous Microsoft NET ASP NET conversation.