2

Can i access @Umbraco.getDictionaryItem Helper in my Custom Controller in my custom Area and then add it to the model of the custom partial page which i am rendering through plain jquery Ajax. And also it would b great if i can access it in my Surface Controller plugin.

Thanks,

Sher

Sher
  • 341
  • 1
  • 16

2 Answers2

0

You should be able to access it in your server side files, yes. You just need to make sure you have a reference to the correct Umbraco DLLs in your project (not 100% sure off the top of my head which DLL the method resides in though, you'll have to look that up in the source).

Tim
  • 4,217
  • 1
  • 15
  • 21
  • :) can you be a little more specific as i have tried to work through code but no luck, the only work around i am able to do is to pass the converted values through jquery ajax and add them to my model n then use them in my partial view. – Sher May 11 '12 at 03:53
0

Create your custom controller as Surface Controller, and obtain the IRoutableRequestContext,

public class propertydetailsController : SurfaceController
{
    private IRoutableRequestContext _routableRequestContext;
}

then access the Dictionary helper class in Umbraco.Cms.Web.Dictionary, sample code is below.

DictionaryHelper dictionaryHelper = new DictionaryHelper(_routableRequestContext.Application);
string valueDictionary = dictionaryHelper.GetDictionaryItemValueForLanguage("DictionaryName", "en-GB");

Cheers

Sher
  • 341
  • 1
  • 16
  • Where can you find this Umbraco.Cms.Web.Dictionary class? I searched around for quite some time... there is no evidence anywhere online of the DictionaryHelper existance, at least for v6.1.6, v6.2.5 and v7. Did it disappear after the OP accepted this answer? I searched the source code, nothing found for DictionaryHelper: https://github.com/umbraco/Umbraco-CMS/search?utf8=%E2%9C%93&q=DictionaryHelper – firepol Feb 27 '15 at 09:07
  • Actually this question was when Umbraco was new into the MVC framework and there were lots of problems. as I remember it was some variation of v5... Umbraco rewrote the whole structure after v5 so it s a huge possibility that it is now discontinued. – Sher Feb 28 '15 at 10:49
  • thank you. I actually opened a new question for this and posted some up-to-date code I'm using in umbraco v6 to solve this: http://stackoverflow.com/questions/28811485/umbraco-get-dictionary-item-by-language-how in the question I ask for a better way. Let's see if some umbraco professionals have the answer... – firepol Mar 02 '15 at 13:57