Dirk Bergmann

Developer, panographer. Does consultancy work from own company. Lives in Chiang Mai, Thailand.


Chiang Mai

Hua Hin

Thailand Hotels

ListVote - List. Vote. Learn.

Partnerseek - Find Partners

Using DetailsView to insert when the DataSet is Empty

Scott Mitchell has what is probably the smoothest solution for the GridView which works for the DetailsView just the same:

  1. Put a DetailsView into the EmptyDataTemplate of the "parent DetailsView"
  2. Bind it to the same datasource as the parent
  3. Set the DefaultMode of  the child to "Insert"

Alternatively, you can put a Button into the EmptyDataTemplate and define the click event handler as follows:

protected void Button1_Click(object sender, EventArgs e)