I've wrote a contact form in Visual Studio and I need to translate the placeholder in the textboxes. I am using Umbraco 7.1.8 and I created there a Dictionary Item which is called Vorname.
using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Mail; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using umbraco.BusinessLogic; using umbraco;
public partial class Controls_Kontaktformular : System.Web.UI.UserControl { /// /// Beim Laden der Seite wird btnSend_Click initalisiert. /// /// /// protected void Page_Load(object sender, EventArgs e) { Page.EnableViewState = true; btnSend.Click += btnSend_Click; }
/// /// Wenn auf den btnsend geklickt wird. /// wird eine nachricht per email versendet. /// /// /// void btnSend_Click(object sender, EventArgs e) { MailMessage message = new MailMessage( "[email protected]", BoxEMail.Text, "Quarterly data report.", GetMsgTxt() ); message.IsBodyHtml = true;
Placeholder does't work with the Dictionaryitem
Hello Guys,
I've wrote a contact form in Visual Studio and I need to translate the placeholder in the textboxes.
I am using Umbraco 7.1.8 and I created there a Dictionary Item which is called Vorname.
My Textbox:
I tried the following placeholders :
And nothing has worked.
Would be really nice if someone could help me.
Sincerely David :)
HI David,
If you are using Umbraco 7 and MVC try this:
Hope this helps,
/Dennis
Hi Dennis,
thank you for your fast answer.
Yes, I'm using Umbraco 7.
No, I'm using Webforms and the Placeholder still doesn't works. :(
The output of my placeholder is: @Umbraco.GetDictionaryValue('Vorname')
Sincerely David :)
Hi David
You should be able to use umbraco.library.GetDictionaryItem("UserControl_Details") in your placeholder.
So this really should work
placeholder="umbraco.library.GetDictionaryItem("Vorname")"
Make sure you reference umbraco.BuisnessLogic in your using statements.
Hope this helps.
/Jan
Could you show us your entire code instead of just the snippets you have been trying?
/Jan
Hi Jan,
it still doesnt work.
Ok sorry. Here is my ascx file :
And this is the ascx.cs file:
I recieve an Error where my control should appear.
Error loading userControl '~/usercontrols/Kontaktformular.ascx'
Sincerely David :)
Hi David,
Perhaps, this blogpost from Tim can help you http://www.nibble.be/?cat=7&paged=2
Look at the middle of the page. .net usercontrols and the umbraco dictionary 10
Hope this helps,
/Dennis
Hi David
If you look in the /app_data/logs file can you then see some further details related to this error? it should be marked with "ERROR" in the log.
I suspect you might need to reference the umbraco.dll in order to be able to call umbraco.library methods. But I'm not sure :)
This blogpost http://www.richardsoeteman.net/2009/04/01/AutoAddDictionaryItemsAnotherApproach.aspx from Richard Soeteman is 5 years old, but I think it's stille the same concept for fetching the Dictionary items when using Webforms.
/Jan
Thanks for your answers!
I've found a solution.
I just added a attribute in the codebehind.
Sincerely David :)
is working on a reply...