How to connect to ASP: DetailsView Insert mode via external page
Unlike many ASP.NET docs and examples, I am making a gridview list on one page and linking to a second page to make an edit / update view by sending the record ID to a GET string.
In my edit / update view, I am using ASP: DetailsView to view, edit and insert records. All this is wonderful.
On the page detailsView
, I have an autogenerated link new record
that uses postbacks to show the completed filled insert form.
The only problem is, I have no idea how to link to a insert
view detailsView
from an external page. Did I miss something?
source to share
I might misunderstand your question, but ...
I don't believe you can "reference the insert view", but what you can do is programmatically change the DetailsView mode after the page has loaded. Remember to check that the passed id is relevant first.
For example:
If Not idValue Is Nothing Then
yourDetailsViewName.ChangeMode(DetailsViewMode.Insert)
End If
Check out the MSDN page for more information:
DetailsView.ChangeMode Method
source to share
I just wanted to follow through and say that while I didn't find a way to reference the specific state of the page, I did find the dataview's DefaultMode option, which at least allows you to select an initial state.
Thus: DefaultMode = "Paste"
At least you can choose the default insert mode.
source to share