DetailsView defaultMode question

S

Seth Williams

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top