Feed aggregator
Re: Viewdata in Application.spark
just add a viewdata tag to the top of the view as such:
<viewdata model='IList[[MenuItem]]' />
you can then access the model property as in webforms view engine. There is
much more documentation on it at the spark website.
Hope this helps.
Precompiling to static assembly in .NET 4.0
dynamically compiles correctly ... but after the app pool recycles
isn't able to resolve all referenced assemblies. Quite similar to the
problem discussed here: [link].
Re: Viewdata in Application.spark
(using .Net 3.5):
1) Make a MenuItemViewMode.cs with needed properties like Text and
Link (or just use your MenuItem if just a DTO).
2) Add a BuildMenuList.cs filter that in OnActionExecuting does your
query, maps each MenuItem to MenuItemViewModel, and sets
Viewdata in Application.spark
I have written this in the mode/menu.cs file:
IQueryable<MenuItem> ViewMenu()
{
return from ost in db.MenuItems
orderby ost.SortID
select ost;
}
I want to use this in the application.spark file to view the menu on
Re: SparkViewEngine spontaneous NullReferenceException while rendering view
master and some dummy childactions / partial views.
If i ever get more time to look at it i will think about stripping
down the project until the exception dissapears, hopefully pinpointing
the exact spot of the problem this way.
Commented Issue: Force CompilerParameters.TreatWarningsAsErrors = false in BatchCompiler.Compile() [3873]
By default TreatWarningsAsErrors = (WarningLevel > 0).
I don't want to touch WarningLevel in my system.codedom section, and <providerOption name="WarnAsError" value="false" /> is taken into account only for Web Forms compilation.
So it will be nice to to set TreatWarningsAsErrors = false in code. Or at least read the provider <providerOption name="WarnAsError" value="false" /> (unfortunately it is internal so read is only possible via reflection).
Commented Issue: Force CompilerParameters.TreatWarningsAsErrors = false in BatchCompiler.Compile() [3873]
By default TreatWarningsAsErrors = (WarningLevel > 0).
I don't want to touch WarningLevel in my system.codedom section, and <providerOption name="WarnAsError" value="false" /> is taken into account only for Web Forms compilation.
So it will be nice to to set TreatWarningsAsErrors = false in code. Or at least read the provider <providerOption name="WarnAsError" value="false" /> (unfortunately it is internal so read is only possible via reflection).
Re: Warning as Error
culpa. Easier still is to drop the <system.codedom> section unless
you have need of customizing it.
Re: Warning as Error
system.codedom section for warningLevel="4", which equates to telling
the compiler to treat all warnings as errors. Drop it down to 3.
Re: Warning as Error
temporarily disabled with an <if condition="false"> block.
I'd love to have this be configurable, as my spark compilation
integration tests would benefit greatly from finding warnings as
errors (which they currently don't--with the same web.config section,
Re: Bindings
as part of a dictionary, as part of viewdata or even the viewdata
model itself.
Is it possilbe I may need to change a setting somewhere?
Cheers
Re: Bindings
Thanks for the replies and sorry to sound like a bit of a hassle.
I really like the idea of bindings hence perservering with them.
Having tried Louis' lates suggestion I get the error:
error CS1040: Preprocessor directives must appear as the first non-
whitespace character on a line
RE: Bindings
<element name="partial">#Html.RenderPar tial("@name", @data)</element>
But I think your usage might need some adjustments around the quoting of attributes...
<partial name="'FeedbackPageTable'" data=Model />
Try:
<partial name="FeedbackPageTable" data="Model" />
-----Original Message-----
Re: Bindings
[link]
Re: Bindings
Is there a property for passing a model to the partial?
Re: Bindings
Html.RenderPartial (to my knowledge) is the MSMVC helper used when rendering ascx partials. In your case, if your partial is a spark partial, then you don't need Bindings, you can just call it by typing <FeedbackPageTable/>
Bindings
Secondly: I cannot get them to work correctly in some cases.
I have tried to create a partial binding that renders a partial view
by passing a name and a model:
Binding:
<element name="partial">#Html.RenderPar tial("@name", @data)</element>
Code that I want it to replace in my view:
Commented Issue: SparkSense throws an exception whenever it runs [6846]
279 ERROR System.ArgumentException: An item with the same key has already been added. at System.ThrowHelper.ThrowArgume ntException(ExceptionResource resource) at System.Collections.Generic.Dic tionary`2.Insert(TKey key, TValue value, Boolean add) at SparkSense.Parsing.ProjectExpl orer.ScanProjectItemForViews(P rojectItem projectItem) at SparkSense.Parsing.ProjectExpl orer.ScanProjectItemForViews(P rojectItem projectItem) at SparkSense.Parsing.ProjectExpl orer.ScanProjectItemForViews(P rojectItem projectItem) at SparkSense.Parsing.ProjectExpl orer.BuildViewMapFromProjectEn vironment() at SparkSense.Parsing.ProjectExpl orer.get_ProjectViewFolder() at SparkSense.Parsing.ProjectExpl orer.GetViewFolder() at SparkSense.Parsing.ViewExplore r.InitCurrentView() at SparkSense.Parsing.ViewExplore r..ctor(IProjectExplorer projectExplorer) at SparkSense.StatementCompletion .CompletionSource..ctor(ITextB uffer textBuffer, IProjectExplorer projectExplorer) at SparkSense.StatementCompletion .CompletionListe
Commented Issue: SparkSense throws an exception whenever it runs [6846]
279 ERROR System.ArgumentException: An item with the same key has already been added. at System.ThrowHelper.ThrowArgume ntException(ExceptionResource resource) at System.Collections.Generic.Dic tionary`2.Insert(TKey key, TValue value, Boolean add) at SparkSense.Parsing.ProjectExpl orer.ScanProjectItemForViews(P rojectItem projectItem) at SparkSense.Parsing.ProjectExpl orer.ScanProjectItemForViews(P rojectItem projectItem) at SparkSense.Parsing.ProjectExpl orer.ScanProjectItemForViews(P rojectItem projectItem) at SparkSense.Parsing.ProjectExpl orer.BuildViewMapFromProjectEn vironment() at SparkSense.Parsing.ProjectExpl orer.get_ProjectViewFolder() at SparkSense.Parsing.ProjectExpl orer.GetViewFolder() at SparkSense.Parsing.ViewExplore r.InitCurrentView() at SparkSense.Parsing.ViewExplore r..ctor(IProjectExplorer projectExplorer) at SparkSense.StatementCompletion .CompletionSource..ctor(ITextB uffer textBuffer, IProjectExplorer projectExplorer) at SparkSense.StatementCompletion .CompletionListe
An assembly with the same simple name.. side-by-side
Happens about 1 in every 3 debugging attempts. Usually a clean,
rebuild, iisreset, rebuild sorts it but its bloody annoying and only
ever happens when using Spark.
I've had this in both .Net 4.0 and .Net 3.5 on two dev machines and
occasionally on server (when not stoppping app pools before copying).
