Beispiel #1
0
        /// <summary>
        /// Checks a dataitem for a attribute, returns list found
        /// </summary>
        /// <param name="dataItem"></param>
        /// <param name="attName"></param>
        /// <returns></returns>
        private ArrayList GetAttributes(object dataItem, string attName)
        {
            string    expr    = "@" + attName;
            ArrayList attList = XPathBinder.Select(dataItem, expr) as ArrayList;

            return(attList);
        }
Beispiel #2
0
        /// <summary>
        /// During binding, set text and link for common tasks if permission exists
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SetTaskLink(object sender, RepeaterItemEventArgs e)
        {
            string     page        = DataBinder.Eval(e.Item.DataItem, "page").ToString();
            string     displayName = DataBinder.Eval(e.Item.DataItem, "displayName").ToString();
            string     permission  = DataBinder.Eval(e.Item.DataItem, "permission").ToString();
            HtmlAnchor taskLink    = e.Item.FindControl("taskLink") as HtmlAnchor;

            bool   enabled = false;
            object o       = XPathBinder.Eval(e.Item.DataItem, "@enabled");

            if (o != null)
            {
                enabled = bool.Parse(o.ToString());
            }


            if (enabled && PermissionManager.HasPermission(permission))
            {
                taskLink.Visible = true;
                string onClickEvent = "return showCommonTaskLink('" + PageUtil.EscapeSingleQuotes(page) + "', '" + PageUtil.EscapeSingleQuotes(displayName) + "');";
                taskLink.Attributes.Add("onclick", onClickEvent);
            }
            else
            {
                taskLink.Visible = false;
            }
        }
Beispiel #3
0
        protected void RssOutput_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                // Reference the various controls
                HyperLink lnkTitle       = e.Item.FindControl("lnkTitle") as HyperLink;
                Label     lblPubDate     = e.Item.FindControl("lblPubDate") as Label;
                Label     lblDescription = e.Item.FindControl("lblDescription") as Label;

                // Show the pub date, if it exists
                object dateVal = XPathBinder.Eval(e.Item.DataItem, "pubDate");
                if (dateVal != null && dateVal.ToString().Length > 0)
                {
                    lblPubDate.Text = string.Concat("(", Convert.ToDateTime(dateVal).ToShortDateString(), ")");
                }
                else
                {
                    lblPubDate.Text = string.Empty;
                }

                // Show or hide the description as needed
                lblDescription.Visible = ShowDescription;
            }
        }