MyHeadHurts
MyHeadHurts

Reputation: 1562

Details View in Asp.net, Set it to NEW

I have a grid view on my page, and a hidden details view. When the user wants to add a new entry, they will click a button, and the gridview will become hidden and the details view will become visible. The only problem is I want my details view to automatically be set empty in the NEW mode, without them having to click the new in the details view form.

Upvotes: 0

Views: 516

Answers (2)

gbs
gbs

Reputation: 7266

On button click change the mode like:

DetailsView1.ChangeMode(DetailsViewMode.Insert)

Upvotes: 1

Joel Etherton
Joel Etherton

Reputation: 37533

In the RowCommand event of the gridview:

myDetailsView.Visible = true;
myDetailsView.CurrentMode = DetailsViewMode.Insert;
myGridView.Visible = false;

Upvotes: 1

Related Questions