Пример #1
0
        protected void getSummary()
        {
            string[]  properties = _props.Split(',');
            string[]  titles     = _headers.Split(',');
            DataTable table      = new DataTable();

            try
            {
                if (properties.Length != titles.Length)
                {
                    throw new AmbiguousMatchException("The number of properties and titles are not equal. Unsure what to display!");
                }
            }
            catch (Exception ex) { HandleException(ex); }

            try
            {
                DataRow row   = table.NewRow();
                int     count = 0;
                foreach (string title in titles)
                {
                    table.Columns.Add(title, typeof(string));
                    row[title] = SPContext.Current.Web.AllProperties[properties[count]];
                    count++;
                }
                table.Rows.Add(row);
                Summary.DataSource = table;
                Summary.DataBind();
                if (SPContext.Current.Web.AllProperties["isLinkedMatter"].ToString().ToLower() != "true")
                {
                    JavaScriptSerializer js = new JavaScriptSerializer();
                    editLink.Text = "<a href = 'javascript:window.spPropertyBag.init(" + js.Serialize(properties) + ");'>Edit properties</a>";
                }
            }
            catch (Exception ex) { HandleException(ex); }
        }