Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Fuji Kusaka 2203 posts 4220 karma points
    Jun 18, 2013 @ 14:22
    Fuji Kusaka
    0

    Datatype value with multilingual website

    Hi folks,

    Has anyone used Dictionary DataType with v4.9.1 ? 

    Here is my issue i would like to be able to get the item or media nodename by default if ever the alternative alt or title tag is empty depending on the culture.

    But if left empty here i get an empty alt tag instead. Below is my cshtml file. 

    foreach(var item in slides){
                            if(item.getProperty("test").Value.ToString() != String.Empty){
                                XElement xmlParser = XElement.Parse(item.getProperty("test").Value.ToString());
                                IEnumerable query = from array in xmlParser.Elements("value") select array;
                                string cultureName = System.Threading.Thread.CurrentThread.CurrentCulture.Name;
                                    
                                foreach(XElement rep in query){
                                    if(cultureName == rep.FirstAttribute.Value.ToString()){
                                        String title = (rep.Value.ToString() != null) ? rep.Value.ToString() : item.Text;
                                        <li><img src="@item.getProperty("umbracoFile").Value" alt="@title" /></li> 
                                    }
                                   
                                }
                            }
                            else{                           
                                <li><img src="@item.getProperty("umbracoFile").Value" alt="@Html.Raw(item.Text) **" /></li> 
                            }

                        }

     

    Any help on this please ?

  • Fuji Kusaka 2203 posts 4220 karma points
    Jun 18, 2013 @ 14:34
    Fuji Kusaka
    0

    Ah my mistake, got it working here

    String title = (rep.Value.ToString() != "")? rep.Value.ToString() : item.Text;
Please Sign in or register to post replies

Write your reply to:

Draft