Link to home
Start Free TrialLog in
Avatar of Lorna70
Lorna70

asked on

DetailsView - how to default to edit mode if record exists and Insert mode if it doesn't?

I have a DetailsView for Insert and Edits which I pass custID parameter by Querystring.  I need the DetailsView to go into Edit mode if a record is returned for this customer from the db and if not, I need it to go into Insert mode.  I'm using ASP.Net 2.0 - there must be an easy way to do this surely?
Avatar of puru1981
puru1981

I think you can change the defaultmode property after seeing the result.

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.detailsview.defaultmode.aspx
ASKER CERTIFIED SOLUTION
Avatar of carlnorrbom
carlnorrbom
Flag of Sweden image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi,

Did you have a look at this?

/Carl.
Avatar of Lorna70

ASKER

Yes thanks - that works (although I had to change it to C#).