Exemplo n.º 1
0
        private void DgContents_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }

            var id        = SqlUtils.EvalInt(e.Item.DataItem, "ID");
            var itemName  = (string)DataBinder.Eval(e.Item.DataItem, "ItemName");
            var itemValue = (string)DataBinder.Eval(e.Item.DataItem, "ItemValue");

            var ltlItemName      = (Literal)e.Item.FindControl("ltlItemName");
            var ltlItemValue     = (Literal)e.Item.FindControl("ltlItemValue");
            var hlUpLinkButton   = (HyperLink)e.Item.FindControl("hlUpLinkButton");
            var hlDownLinkButton = (HyperLink)e.Item.FindControl("hlDownLinkButton");
            var ltlEditUrl       = (Literal)e.Item.FindControl("ltlEditUrl");
            var ltlDeleteUrl     = (Literal)e.Item.FindControl("ltlDeleteUrl");

            if (_level >= _totalLevel)
            {
                ltlItemName.Text = itemName;
            }
            else
            {
                ltlItemName.Text =
                    $@"<a href=""{GetRedirectUrl(PublishmentSystemId,
                        _relatedFieldId, id, _level + 1)}"" target=""level{_level + 1}"">{itemName}</a>";
            }
            ltlItemValue.Text          = itemValue;
            hlUpLinkButton.NavigateUrl = GetRedirectUrl(PublishmentSystemId, _relatedFieldId, _parentId, _level) + "&Up=True&ID=" + id;

            hlDownLinkButton.NavigateUrl = GetRedirectUrl(PublishmentSystemId, _relatedFieldId, _parentId, _level) + "&Down=True&ID=" + id;

            ltlEditUrl.Text =
                $@"<a href='javascript:;' onclick=""{ModalRelatedFieldItemEdit.GetOpenWindowString(
                    PublishmentSystemId, _relatedFieldId, _parentId, _level, id)}"">编辑</a>";

            ltlDeleteUrl.Text =
                $@"<a href=""{GetRedirectUrl(PublishmentSystemId, _relatedFieldId, _parentId, _level)}&Delete=True&ID={id}"" onClick=""javascript:return confirm('此操作将删除字段项“{itemName}”及其子类,确认吗?');"">删除</a>";
        }
Exemplo n.º 2
0
        private void RptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }

            var itemInfo = (RelatedFieldItemInfo)e.Item.DataItem;

            var ltlItemName  = (Literal)e.Item.FindControl("ltlItemName");
            var ltlItemValue = (Literal)e.Item.FindControl("ltlItemValue");
            var hlUp         = (HyperLink)e.Item.FindControl("hlUp");
            var hlDown       = (HyperLink)e.Item.FindControl("hlDown");
            var ltlEditUrl   = (Literal)e.Item.FindControl("ltlEditUrl");
            var ltlDeleteUrl = (Literal)e.Item.FindControl("ltlDeleteUrl");

            if (_level >= _totalLevel)
            {
                ltlItemName.Text = itemInfo.ItemName;
            }
            else
            {
                ltlItemName.Text =
                    $@"<a href=""{GetRedirectUrl(SiteId,
                        _relatedFieldId, itemInfo.Id, _level + 1)}"" target=""level{_level + 1}"">{itemInfo.ItemName}</a>";
            }

            ltlItemValue.Text  = itemInfo.ItemValue;
            hlUp.NavigateUrl   = GetRedirectUrl(SiteId, _relatedFieldId, _parentId, _level) + "&Up=True&ID=" + itemInfo.Id;
            hlDown.NavigateUrl = GetRedirectUrl(SiteId, _relatedFieldId, _parentId, _level) + "&Down=True&ID=" + itemInfo.Id;

            ltlEditUrl.Text =
                $@"<a href='javascript:;' onclick=""{ModalRelatedFieldItemEdit.GetOpenWindowString(
                    SiteId, _relatedFieldId, _parentId, _level, itemInfo.Id)}"">编辑</a>";

            ltlDeleteUrl.Text =
                $@"<a href=""{GetRedirectUrl(SiteId, _relatedFieldId, _parentId, _level)}&Delete=True&ID={itemInfo.Id}"" onClick=""javascript:return confirm('此操作将删除字段项“{itemInfo.ItemName}”及其子类,确认吗?');"">删除</a>";
        }