i'm using a query repeater to get form data and have a file on the form but cannot figure out how to make a link to the file in the transformation. Thoughts?
The bizform files are accessible to logged in users only. You may need to compose the URL in your transformation to have this format: /CMSPages/GetBizFormFile.aspx?filename=<FileGUID>.<extension>&sitename=<SiteCodeName> The file name is the file GUID since the files are stored on disk with the GUID as the name.
/CMSPages/GetBizFormFile.aspx?filename=<FileGUID>.<extension>&sitename=<SiteCodeName>
that is what I was trying, but when i eval the file field it spits out this "a6b83009-a39b-4fa9-9862-3a78e4610e56.eps/int_nl_sm_v_p_blk_4cp_180206.eps" I tried Eval("file").Split("/")[0] to get the first part but i get an error on the site.
Eval("file").Split("/")[0]
What is the error you are getting?
sorry for the late response was on vacation this is the error [TempITemplate.Template]: http://server/CMSVirtualFiles/Transformations/=vg=f0a07eb0-1bd2-4997-a586-f79536d4ebf3/CMS.Root/Followupmessage.ascx(6): error CS1061: 'object' does not contain a definition for 'Split' and no accessible extension method 'Split' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
[TempITemplate.Template]: http://server/CMSVirtualFiles/Transformations/=vg=f0a07eb0-1bd2-4997-a586-f79536d4ebf3/CMS.Root/Followupmessage.ascx(6): error CS1061: 'object' does not contain a definition for 'Split' and no accessible extension method 'Split' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
The Eval method returns probably an object but the Split method can be applied on a string data type. Could you please try to cast it to string at first.
trying this Eval("File").ToString().Split("/")[0] I get this error [TempITemplate.Template]: http://server/CMSVirtualFiles/Transformations/=vg=05856e79-5742-4450-8d67-c96a57470017/CMS.Root/Followupmessage.ascx(6): error CS1503: Argument 1: cannot convert from 'string' to 'char'
Eval("File").ToString().Split("/")[0]
[TempITemplate.Template]: http://server/CMSVirtualFiles/Transformations/=vg=05856e79-5742-4450-8d67-c96a57470017/CMS.Root/Followupmessage.ascx(6): error CS1503: Argument 1: cannot convert from 'string' to 'char'
Eval("File").ToString().Split('/')[0] This seems to work. Needed the single quotes. But i do get another error if I have this in the transformation twice. Eval("File").ToString().Split('/')[1] this what to pull the file name. [CMSAbstractTransformation.DataBind]: Index was outside the bounds of the array. I do have the whole line of code in an IfEmpty() but still get the error on the items that don;t have a file at all.
Eval("File").ToString().Split('/')[0]
Eval("File").ToString().Split('/')[1]
[CMSAbstractTransformation.DataBind]: Index was outside the bounds of the array.
IfEmpty()
If you want to cast the object using eval, you should use Eval< ReturnType > . Anyway, I think I found an easier way how to link the file - using direct physical path link like this (I had to add extra spaces around "<" so it is not encoded): < a href="~/< SiteName >/BizFormFiles/< %# Eval< string >("FileColumnName").Split('/')[0] % > " >Link< /a >
< a href="~/< SiteName >/BizFormFiles/< %# Eval< string >("FileColumnName").Split('/')[0] % > " >Link< /a >
Please, sign in to be able to submit a new answer.