I would like to add the following asp login control to a razor script. It only displays the text and not the control. Apologies if this is an crazy question, I'm quite new to razor and Umbraco.
var currentUser = Member.GetCurrentMember(); if (currentUser!=null) { var userName = currentUser.Text; var userLastName = currentUser.getProperty("lastName").Value.ToString(); @userName @userLastName }
I don't think this will be possible really. I've experimented with using @Html.Partial to render an ascx before, but Postback doesn't work, so kind of a moot point. There's also an article here with some different methods, haven't looked into it though. You could also wrap a usercontrol with your login form in a macro, and try using RenderMacro to render it, but I have a feeling postback won't work there either.
Long story short, probably not worth the trouble. If you're looking for a simple login form that'll work in Razor, check out the RazorLogin package, it works great :)
Include ASP control in Razor script
Hi
I would like to add the following asp login control to a razor script. It only displays the text and not the control. Apologies if this is an crazy question, I'm quite new to razor and Umbraco.
Would be quite amazing if someone can get this working.
In razor you could do it this way
//fuji
I don't think this will be possible really. I've experimented with using @Html.Partial to render an ascx before, but Postback doesn't work, so kind of a moot point. There's also an article here with some different methods, haven't looked into it though. You could also wrap a usercontrol with your login form in a macro, and try using RenderMacro to render it, but I have a feeling postback won't work there either.
Long story short, probably not worth the trouble. If you're looking for a simple login form that'll work in Razor, check out the RazorLogin package, it works great :)
-Tom
is working on a reply...