Quantcast
Channel: C1 CMS Foundation - Open Source on .NET
Viewing all articles
Browse latest Browse all 2540

New Post: "Insert -> Field" yields Global Data Type GUID instead of Title field

$
0
0

I need a solution and I have one that works, but I'd still love to hear from anyone with a cleaner solution.

I ended up modifying the ResolveFields method in Composite.Forms.ContactForm.Functions.cs.

I changed this:

var prValue = pr.GetValue(dataItem, null).ToString().Replace(Environment.NewLine, "
");
XElement xl = XElement.Parse(String.Format("<span>{0}</span>", prValue));
reference.FieldReferenceElement.ReplaceWith(xl);

To this:

var prValue = pr.GetValue(dataItem, null).ToString().Replace(Environment.NewLine, "
");
if (pr.Name == "Department")
{
    using (DataConnection con = new DataConnection())
    {
        prValue = con.Get<DepartmentContact>().Where(dc => dc.Id == new Guid(prValue)).SingleOrDefault().Department;
    }
}
XElement xl = XElement.Parse(String.Format("<span>{0}</span>", prValue));
reference.FieldReferenceElement.ReplaceWith(xl);

I'd still like to know if there's an XLST solution.


Viewing all articles
Browse latest Browse all 2540

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>