tags:

views:

66

answers:

2

i have generated the views (Create, Edit, Index, Details) for a table using LINQ to SQL.

My question is:

Once the views are created in Visual Studio using "Add, View", they dont change when i update the database (using Server Explorer) and the LINQ to SQL code.

Is there anyway to "Refresh" the view code, or do i just have to delete the existing ones and create new ones?

A: 

It might be handy to post a few lines of code here but here are the things I would check;

  1. Is the database being updated
  2. When you return your view after a postback are you reloading the data?
  3. Are you doing a JSON postback and not handling the callback event?
  4. After the submit are you returning the FormViewModel with the new data in it?
griegs
i am talking about the view code that gets autogenerated when you do a "Add -> View" in Visual Studio
ooo
+3  A: 

I see what you mean and as far as I can tell there is no way other than to begin again.

Having said that though any changes you make to the LINQ to SQL classes I would imagine be fairly minor so coding them wouldn't really pose that much of an issue.

I wouldn't, personally, delete and start again when I add fields I'd simply code in the changes as generally speaking I've modified the auto generated views to reflect my styles and layout.

Using the AutoGenerator is great for doing a lot of the grunt work up front but after that you're kinda on your own I think.

griegs