dotnetcurry / data-driven-view-engine-dncmag-07

A deep dive into how to build a Custom View Engine whose View layout is stored in a database. This is Code for the Article in DNC Magazine Issue 7 (July-August 2013). The magazine is absolutely Free.
http://www.dotnetcurry.com/magazine/dnc-magazine-issue7.aspx
8 stars 6 forks source link

Sequence contains no elements Exception throws #1

Open Prasadambulkar3 opened 8 years ago

Prasadambulkar3 commented 8 years ago

It throws : Sequence contains no elements when try http://localhost:[myurl]/Home/Dynamic/BlogPost while visiting this url.

public void Render(ViewContext viewContext, TextWriter writer) { DataForm dataForm = dbContext.DataForms.Include("Fields").First(f => f.Name == _viewName);

Am I missing something?

mrtpitt commented 7 years ago

Create new dataform. name it "Test" and call /Home/Dynamic/Test it will work.

mdarif8 commented 4 years ago

I have tested with /Home/Dynamic/Test then i am getting "Object reference not set to an instance of an object." in this line of code "if (!string.IsNullOrEmpty(dataForm.SubmitUrl))"