private void RptContents_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem) { return; } var fileName = (string)e.Item.DataItem; var ltlFileName = (Literal)e.Item.FindControl("ltlFileName"); var ltlCharset = (Literal)e.Item.FindControl("ltlCharset"); var ltlView = (Literal)e.Item.FindControl("ltlView"); var ltlEdit = (Literal)e.Item.FindControl("ltlEdit"); var ltlDelete = (Literal)e.Item.FindControl("ltlDelete"); ltlFileName.Text = fileName; var charset = FileUtils.GetFileCharset(PathUtils.Combine(_directoryPath, fileName)); ltlCharset.Text = ECharsetUtils.GetText(charset); ltlView.Text = $@"<a href=""{SiteInfo.Additional.WebUrl}/css/{fileName}"" target=""_blank"">查看</a>"; ltlEdit.Text = $@"<a href=""{PageTemplateCssAdd.GetRedirectUrl(SiteId, fileName)}"">编辑</a>"; ltlDelete.Text = $@"<a href=""javascript:;"" onclick=""{AlertUtils.ConfirmDelete("删除文件", "此操作将删除样式文件,确认吗", $"{GetRedirectUrl(SiteId)}&Delete={true}&FileName={fileName}")}"">删除</a>"; }
private void RptContents_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem) { return; } var fileName = (string)e.Item.DataItem; var ltlFileName = (Literal)e.Item.FindControl("ltlFileName"); var ltlCharset = (Literal)e.Item.FindControl("ltlCharset"); var ltlView = (Literal)e.Item.FindControl("ltlView"); var ltlEdit = (Literal)e.Item.FindControl("ltlEdit"); var ltlDelete = (Literal)e.Item.FindControl("ltlDelete"); ltlFileName.Text = fileName; var charset = FileUtils.GetFileCharset(PathUtils.Combine(_directoryPath, fileName)); ltlCharset.Text = ECharsetUtils.GetText(charset); ltlView.Text = $@"<a href=""{PageUtility.GetSiteUrl(SiteInfo, $"{_assetsDir}/{fileName}", true)}"" target=""_blank"">查看</a>"; ltlEdit.Text = $@"<a href=""{PageTemplateAssetsAdd.GetRedirectUrlToEdit(SiteId, _type, fileName)}"">编辑</a>"; ltlDelete.Text = $@"<a href=""javascript:;"" onclick=""{AlertUtils.ConfirmDelete($"删除{_name}", $"此操作将删除{_name},确认吗", $"{GetRedirectUrl(SiteId, _type)}&delete={true}&fileName={fileName}")}"">删除</a>"; }
public string GetCharset(string fileName) { var charset = FileUtils.GetFileCharset(PathUtils.Combine(_directoryPath, fileName)); return(ECharsetUtils.GetText(charset)); }