Posts

Showing posts from January 28, 2015

creat a table using stirngbilder

sb.Append("<div> ");                                     sb.Append("<table style=\"float:left\">");                                     sb.Append("<tr>");                                     sb.AppendFormat("<td style=\"padding-left: 10px;\">{0}</td>", "<img src='" + imagepath + "'/>");                                     sb.Append("</tr>");                                     sb.Append("<tr>");                                     sb.AppendFormat("<td style=\"text-align: center;\">{0}</td>", Name);                                     sb.Append("</tr>");                                     sb.Append("</table>");                             dr["htmlable"] = sb.Append("</div>");

SpAttachent binding to a grid

if (items.Attachments.Count > 0)                                     {                                         foreach (String attachmentname in items.Attachments)                                         {                                            string attachmentAbsoluteURL = items.Attachments.UrlPrefix + attachmentname;                                             imagepath = attachmentAbsoluteURL.ToString();                                         }                                     }                                     else                                     {                                         imagepath = "/_layouts/15/VrtxIntranetStyles/Images/NoImage.jpg";                                     }

person or group value into a collection

 SPFieldUser userField = (SPFieldUser)item.Fields.GetField("Team");                             userFieldValueCollection = (SPFieldUserValueCollection)userField.GetFieldValue(item["Team"].ToString());                             foreach (SPFieldUserValue user in userFieldValueCollection)                             { do your stuff here }