Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

DetailsView defaultMode question

0 views
Skip to first unread message

Seth Williams

unread,
May 6, 2008, 12:42:34 PM5/6/08
to
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?


0 new messages