tags:

views:

803

answers:

1

I'm binding a hashtable to a detailsview web control in ASP.NET 2.0. I have my edit/delete/insert link buttons on the detailsview, but when clicking new, the mode does not change.

Any ideas why?

If you need code examples, I will be happy to provide them.

Thanks

+1  A: 

I'm assuming that you have created a 'New' Button within the DetailsView. You should be able to simply handle the click event in your CodeBehind, and call the DetailsView.ChangeMode Method.

    DetailsViewName.ChangeMode(DetailsViewMode.Insert)
    DetailsViewName.DataBind()

In this case, I simply rebinded the DetailsView to show a blank form. You can also use the Click event to bind controls within the DetailsView form as well.

Fill out the form, click Add, and the Item_Inserting Event should get handled.