Error Loading Razor Script (file: Newsletter Subscribe) Dit not provide a valid name at NewsletterStudio.Api.Subscribe(String email, String name, Int32 subscriptionId) at NewsletterStudio.Api.Subscribe(String email, Int32 subscriptionId) at ASP._Page_macroScripts_NewsletterSubscribe_cshtml.Execute() in d:\web\localuser\son-smykket.dk\public_html\macroScripts\NewsletterSubscribe.cshtml:line 19 at System.Web.WebPages.WebPageBase.ExecutePageHierarchy() at System.Web.WebPages.WebPage.ExecutePageHierarchy(IEnumerable`1 executors) at System.Web.WebPages.WebPage.ExecutePageHierarchy() at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) at umbraco.MacroEngines.RazorMacroEngine.ExecuteRazor(MacroModel macro, INode currentPage) at umbraco.MacroEngines.RazorMacroEngine.Execute(MacroModel macro, INode currentPage)
@inherits umbraco.MacroEngines.DynamicNodeContext
@{ bool showThankYou = false; string Error = ""; if (Request.Form["action"] != null && Request.Form["action"].ToString() == "subscribe" && Request.Form["txtEmail"].ToString() != "") { String txtEmail = Request.Form["txtEmail"].ToString(); if (NewsletterStudio.Api.IsValidEmail(txtEmail)) { // Trying to get the subscriptionId from Macro-parameter. Int32 subscriptionId = (Parameter.SubscriptionId != null) ? Convert.ToInt32(Parameter.SubscriptionId) : 0;
// Adding subsbriber var success = (subscriptionId != 0) ? NewsletterStudio.Api.Subscribe(txtEmail, subscriptionId) : NewsletterStudio.Api.Subscribe(txtEmail); showThankYou = true; } else { Error = "* Det er ikke en korrekt e-mail"; } } }
I'll put this in the backlog for the next version (comming soon)! Basicly I would change this row: var success = (subscriptionId != 0) ? NewsletterStudio.Api.Subscribe(txtEmail, subscriptionId) : NewsletterStudio.Api.Subscribe(txtEmail);
d:\web\localuser\son-smykket.dk\public_html\macroScripts\634721852133382143_NewsletterSubscribe.cshtml(20): error CS0103: The name 'Common' does not exist in the current context
Of topic: i did install in v 4.7.2 without any problems, and the expirence was fine.
Later today im going to test it, (If i get to work) :-)
Error loading MacroEngine script (file: NewsletterSubscribe.cshtml)
Hi (Tanks for this nice project)
I have this small issue, any ideas..
Just used the razor template for the frontend subscription.
I get this error when trying to submit to newsletter.
Error loading MacroEngine script (file: NewsletterSubscribe.cshtml)
Hi!
Seams like you found a bug here!
I'll put this in the backlog for the next version (comming soon)! Basicly I would change this row:
var success = (subscriptionId != 0) ? NewsletterStudio.Api.Subscribe(txtEmail, subscriptionId) : NewsletterStudio.Api.Subscribe(txtEmail);
TO:
var success = (subscriptionId != 0) ? NewsletterStudio.Api.Subscribe(txtEmail, Common.UppercaseFirst(email.Substring(0, email.IndexOf("@")).Replace(".", " ")), subscriptionId) : NewsletterStudio.Api.Subscribe(txtEmail);
This is to use another method in the api that creates the new subscriber. Does this work?
Of topic: Did you install Newsletter Studio in v4.7.2 without any problems? How was the experiance?
HI
Sorry, it did not work, i get this error.
Error occured
d:\web\localuser\son-smykket.dk\public_html\macroScripts\634721852133382143_NewsletterSubscribe.cshtml(20): error CS0103: The name 'Common' does not exist in the current context
Of topic: i did install in v 4.7.2 without any problems, and the expirence was fine.
Later today im going to test it, (If i get to work) :-)
Tanks
René
Hi!
You may need to add a using statement to include the common-class, it in the "NewsletterStudio"-namespace. Just add something like:
@using NewsletterStudio
At the top of you macro.
HI
Solved, tanks
I had to add: @using NewsletterStudio at the top
And change this: "email.Substring(0, email.IndexOf" to this "txtEmail.Substring(0, txtEmail.IndexOf"
Here is the string as i used, this is working
var success = (subscriptionId != 0) ? NewsletterStudio.Api.Subscribe(txtEmail, Common.UppercaseFirst
(txtEmail.Substring(0, txtEmail.IndexOf("@")).Replace(".", " ")), subscriptionId) :
NewsletterStudio.Api.Subscribe(txtEmail);
Have a nice day
Hi!
Thank you very much for sharing your solution!
is working on a reply...