Hello Team, i am Doing this to get File size in transformation.
< script runat="server" >
string sizeInKb;
protected override void OnInit(EventArgs e) {
CMS.DocumentEngine.AttachmentInfo ai = CMS.DocumentEngine.AttachmentInfoProvider.GetAttachmentInfo(ValidationHelper.GetGuid(Eval("FileAttachment").ToString(), Guid.Empty), CMS.SiteProvider.SiteContext.CurrentSiteName); sizeInKb = string.Format("{0:n1} KB", ai.AttachmentSize/ 1024f);
}
<%#Eval("FileName")%> (<%#sizeInKb%>)
But i am getting this error "[Error loading the control 'Repeater', check event log for more details] "
Well looking at your screenshot it looks like you're using the wrong field in your code..
Change the code in your first comment and update
Eval("FileAttachment")
to:
Eval("FileUpload")
Did you "check the event log for more details"? it might gave a null pointer for some repeated items not having an attachment or something like that.
Kindly direct me to right way, tell what i exactly have to do... i am confused
In the Kentico Administration interface go to the Event Log application and find the error.
Ohh yes its Null exception, But then what is the way to file size of the attachment ,
kindly tell me the whole procedure i ll be very thankful!
Screenshot https://ibb.co/fCjAeH
ohh my Bad.. thankyou for help sir. :)
Please, sign in to be able to submit a new answer.