How do I link to an ASP:DetailsView's Insert mode via an external page

0 votes
asked Dec 9, 2008 by danieltalsky

Unlike many of the ASP.NET documentation and examples, I'm doing a gridview list on one page, and it links to a 2nd page to do the edit/update view, sending the ID for the record in the GET string.

On my edit/update view, I'm using an ASP:DetailsView for viewing, editing and inserting records. All of this works fine.

On the detailsView page, I have it autogenerating a new record link that uses postback to show the blank insert form to be filled out.

The only problem is, I have no idea how to link to the insert view of the DetailsView from an external page. Am I missing something?

2 Answers

0 votes
answered Dec 10, 2008 by dhaust

I could have misunderstood your question but....

I don't believe you can 'link to the insert view', but what you can do is programmatically change the mode of the DetailsView once the page has loaded. Remember to check that the passed in ID has a value first.

For example:

If Not idValue Is Nothing Then   
End If

Check out the MSDN page for more info:
DetailsView.ChangeMode Method

0 votes
answered Dec 12, 2008 by danieltalsky

I just wanted to follow up and say that, even though I did not find a way to link to a specific page state, I did discover the dataview's DefaultMode parameter, that at least allows you to pick an initial state.

Thus: DefaultMode="Insert"

At least lets you choose insert mode as the default.

Welcome to Q&A, where you can ask questions and receive answers from other members of the community.
Website Online Counter