Auto-create formview templates

Is there a way to auto create the edit item and insert new item templates for a formview?
At present I am faced with creating a 2 column table with 12 rows and binding the controls to the fields....and then doing it again for the insert new item.

Is there no way to auto create the item templates based on the underlying SQL in the data source?

VS2010 c#
LVL 29
Who is Participating?
QPRConnect With a Mentor Author Commented:
I had to delete the whole thing and start again, this time I did get the templates!
The Formview templates for view, insert, edit can be auto-generated if you are assigning the SQLDatasource in design mode. its all generated automatically.

the only thing is,  you have to change the layout (inside a Table as you said) or design of Edit/View/Insert templates of the formview using the smarttag in design view.

QPRAuthor Commented:
I must be missing something? I added a FV to the page and added a sqlsatasource - I specify that the select parameter come from the query string. I test it and a record is returned. Then when I click ok the FV is shown but all templates are empty.
I fire up my site and browse to the FV page but the page is empty.
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

not sure about the cause:

make sure you have emptydatatemplate for the formview.

also check your formview's default mode in properties window.

you could check whether the formview has data by adding a databound code to the formview:

urFormView_Databound (ByVal sender As Object, ByVal e As EventArgs) Handles urFormView.DataBound
    If urFormView.DataItemCount = 0 Then
    End If

Open in new window

the one more example for you:
ok..Glad you have solved it urself
QPRAuthor Commented:
Had to rebuild
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.