Last post Dec 12, 2011 09:48 AM by GrandpaB
Dec 10, 2011 08:38 PM|GrandpaB|LINK
Good afternoon ASP programmers,
I have a page that displays a GridView. The first column of the GridView is a template field. The header template contains a HyperLink whose text="New" and the NavigateUrl I'd like to be a aspx page with a DetailsView that opens the New mode. The New mode
has two buttons Update and Cancel. When the user clicks either button I'd like update or cancel to proceed, but I'd like the user to be returned to the original page with the GridView.
Is this possible and if so how do I configure the Details view to accomplish this?
Dec 10, 2011 09:59 PM|GrandpaB|LINK
I figured out how to open the DetailsView in the Insert mode. The NavigateUrl for page containing the DetailsView is dv.aspx?ID=selectedID. if the user selects a record from the GridView the ID for that record is used for the selectedID, if however the
user clicks the New hyperlink the selectedID is set to zero. Then in the dv.aspx page the preload event transfers the ID value to a hiddenfield. When the page's load event fires the value in the hidden field is tested if it is zero the dvContacts.ChangeMode(DetailsViewMode.Insert)
instruction is run.
I think that this solves my first problem, but how can I configure the Update and Cancel buttons to return to the page with the GridView?
Dec 12, 2011 09:48 AM|GrandpaB|LINK
The last piece of the puzzle has been resolved. The DetailsView ModeChanged event handler now contains the following statement Response.Redirect(GridViewPage.aspx). I should have thought a bit more about my problem before creating this thread, However
writing it out helped me to think about it logically.