void dgContents_ItemDataBound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { var gatherRuleInfo = e.Item.DataItem as GatherRuleInfo; var ltlGatherRuleName = (Literal)e.Item.FindControl("ltlGatherRuleName"); var ltlGatherUrl = (Literal)e.Item.FindControl("ltlGatherUrl"); var ltlLastGatherDate = (Literal)e.Item.FindControl("ltlLastGatherDate"); var ltlIsAutoCreate = (Literal)e.Item.FindControl("ltlIsAutoCreate"); var ltlTestGatherUrl = (Literal)e.Item.FindControl("ltlTestGatherUrl"); var ltlStartGatherUrl = (Literal)e.Item.FindControl("ltlStartGatherUrl"); var ltlEditLink = (Literal)e.Item.FindControl("ltlEditLink"); var ltlCopyLink = (Literal)e.Item.FindControl("ltlCopyLink"); var ltlDeleteLink = (Literal)e.Item.FindControl("ltlDeleteLink"); ltlGatherRuleName.Text = gatherRuleInfo.GatherRuleName; var gatherUrlArrayList = GatherUtility.GetGatherUrlArrayList(gatherRuleInfo); if (gatherUrlArrayList != null && gatherUrlArrayList.Count > 0) { var url = (string)gatherUrlArrayList[0]; url = PageUtils.AddProtocolToUrl(url); ltlGatherUrl.Text = $@"<a href=""{url}"" target=""_blank"" title=""{url}"">{StringUtils.MaxLengthText(url, 25)}</a>"; } if (!DateUtils.SqlMinValue.Equals(gatherRuleInfo.LastGatherDate)) { ltlLastGatherDate.Text = DateUtils.GetDateAndTimeString(gatherRuleInfo.LastGatherDate); } if (gatherRuleInfo.Additional.IsAutoCreate) { ltlIsAutoCreate.Text = "是"; } else { ltlIsAutoCreate.Text = "否"; } var showPopWinString = ModalGatherTest.GetOpenWindowString(PublishmentSystemId, gatherRuleInfo.GatherRuleName, false); ltlTestGatherUrl.Text = $@"<a href=""javascript:;"" onclick=""{showPopWinString}"">测试</a>"; showPopWinString = ModalGatherSet.GetOpenWindowString(PublishmentSystemId, gatherRuleInfo.GatherRuleName); ltlStartGatherUrl.Text = $@"<a href=""javascript:;"" onclick=""{showPopWinString}"">开始采集</a>"; var urlEdit = PageGatherRuleAdd.GetRedirectUrl(PublishmentSystemId, gatherRuleInfo.GatherRuleName); ltlEditLink.Text = $"<a href=\"{urlEdit}\">编辑</a>"; var urlCopy = PageUtils.GetCmsUrl(nameof(PageGatherRule), new NameValueCollection { { "PublishmentSystemID", PublishmentSystemId.ToString() }, { "GatherRuleName", gatherRuleInfo.GatherRuleName }, { "Copy", true.ToString() } }); ltlCopyLink.Text = $@"<a href=""{urlCopy}"">复制</a>"; var urlDelete = PageUtils.GetCmsUrl(nameof(PageGatherRule), new NameValueCollection { { "PublishmentSystemID", PublishmentSystemId.ToString() }, { "GatherRuleName", gatherRuleInfo.GatherRuleName }, { "Delete", true.ToString() } }); ltlDeleteLink.Text = $@"<a href=""{urlDelete}"" onClick=""javascript:return confirm('此操作将删除采集规则“{gatherRuleInfo .GatherRuleName}”,确认吗?');"">删除</a>"; } }
public string GetTestGatherUrl(string gatherRuleName) { var showPopWinString = ModalGatherTest.GetOpenWindowString(PublishmentSystemId, gatherRuleName, true); return($@"<a href=""javascript:;"" onclick=""{showPopWinString}"">测试</a>"); }