private void RetrieveFile(SPListItem nitem)
{
DataTable dthref = new DataTable();
dthref.Columns.Add("ViewFile", typeof(string));
DataRow dataRow;
dataRow = dthref.NewRow();
foreach (String attachmentname in nitem.Attachments)
{
String attachmentAbsoluteURL = nitem.Attachments.UrlPrefix + attachmentname;
//SPFile attachmentFile = SPContext.Current.Web.GetFile(attachmentAbsoluteURL);
HtmlAnchor htmlanchor = new HtmlAnchor();
htmlanchor.HRef = attachmentAbsoluteURL;
dthref.Rows.Add(attachmentAbsoluteURL);
// ViewState["attachmentFile"] = attachmentFile;
ViewState["attachmentAbsoluteURL"] = attachmentAbsoluteURL;
}
dthref.AcceptChanges();
gvFileView.Visible = true;
gvFileView.DataSource = dthref;
gvFileView.DataBind();
}
{
DataTable dthref = new DataTable();
dthref.Columns.Add("ViewFile", typeof(string));
DataRow dataRow;
dataRow = dthref.NewRow();
foreach (String attachmentname in nitem.Attachments)
{
String attachmentAbsoluteURL = nitem.Attachments.UrlPrefix + attachmentname;
//SPFile attachmentFile = SPContext.Current.Web.GetFile(attachmentAbsoluteURL);
HtmlAnchor htmlanchor = new HtmlAnchor();
htmlanchor.HRef = attachmentAbsoluteURL;
dthref.Rows.Add(attachmentAbsoluteURL);
// ViewState["attachmentFile"] = attachmentFile;
ViewState["attachmentAbsoluteURL"] = attachmentAbsoluteURL;
}
dthref.AcceptChanges();
gvFileView.Visible = true;
gvFileView.DataSource = dthref;
gvFileView.DataBind();
}