Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I have a function That prints after gettign the value form a Ultimate Picker
umbraco.NodeFactory.Node.GetCurrent().GetProperty("backCover").Value
but what if the user does nto choose a media item and saves the node
i want to make sur eit genrates print application even without the umbraco.NodeFactory.Node.GetCurrent().GetProperty("backCover").Value
such as
if (umbraco.NodeFactory.Node.GetCurrent().GetProperty("backCover").Value == null) { document.Close(); } else { document.NewPage(); umbraco.cms.businesslogic.media.Media nm = new umbraco.cms.businesslogic.media.Media(Int32.Parse(umbraco.NodeFactory.Node.GetCurrent().GetProperty("backCover").Value)); string fileNameExisting = Server.MapPath(nm.getProperty("umbracoFile").Value.ToString()); PdfReader reader = new PdfReader(fileNameExisting); PdfImportedPage page = writer.GetImportedPage(reader, 1); iTextSharp.text.Image mimage = iTextSharp.text.Image.GetInstance(page); document.Add(mimage); } document.Close();
i also tried If( umbraco.NodeFactory.Node.GetCurrent().GetProperty("backCover").Value !=null)
but it gives this error Input string not in correct format
any solutions or code samples on how i can sovle this problem
Is no value is entered it's probably an empty string. Try this:
if(!string.IsNullOrEmpty(umbraco.NodeFactory.Node.GetCurrent().GetProperty("backCover").Value))
Jeroen
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
umrbaco node factory get propety NULL value check
I have a function That prints after gettign the value form a Ultimate Picker
umbraco.NodeFactory.Node.GetCurrent().GetProperty("backCover").Value
but what if the user does nto choose a media item and saves the node
i want to make sur eit genrates print application even without the umbraco.NodeFactory.Node.GetCurrent().GetProperty("backCover").Value
such as
if (umbraco.NodeFactory.Node.GetCurrent().GetProperty("backCover").Value == null)
{
document.Close();
}
else
{
document.NewPage();
umbraco.cms.businesslogic.media.Media nm = new umbraco.cms.businesslogic.media.Media(Int32.Parse(umbraco.NodeFactory.Node.GetCurrent().GetProperty("backCover").Value));
string fileNameExisting = Server.MapPath(nm.getProperty("umbracoFile").Value.ToString());
PdfReader reader = new PdfReader(fileNameExisting);
PdfImportedPage page = writer.GetImportedPage(reader, 1);
iTextSharp.text.Image mimage = iTextSharp.text.Image.GetInstance(page);
document.Add(mimage);
}
document.Close();
i also tried If( umbraco.NodeFactory.Node.GetCurrent().GetProperty("backCover").Value !=null)
but it gives this error Input string not in correct format
any solutions or code samples on how i can sovle this problem
Is no value is entered it's probably an empty string. Try this:
Jeroen
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.