📄 downloadattachmentlink.cs
字号:
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
// Copyright (c) Telligent Systems Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System;
using System.Web.UI.WebControls;
using CommunityServer.Blogs.Components;
using CommunityServer.Components;
using CommunityServer.Controls;
namespace CommunityServer.Blogs.Controls
{
/// <summary>
/// Summary description for AboutView.
/// </summary>
public class DownloadAttachmentLink : WeblogThemedControl
{
public DownloadAttachmentLink()
{
//
// TODO: Add constructor logic here
//
}
protected HyperLink downloadLink;
private PostAttachmentMetaData _data = null;
protected override void AttachChildControls()
{
downloadLink = FindControl("DownLoadLink") as HyperLink;
}
public PostAttachmentMetaData DataSource
{
get{return _data;}
set{_data = value;}
}
public override void DataBind()
{
base.DataBind ();
if(DataSource != null && downloadLink != null)
{
downloadLink.NavigateUrl = BlogUrls.Instance().AttachmentUrl(this.CurrentWeblog, DataSource);
downloadLink.Text = DataSource.FileName;
if(DataSource.IsRemote)
downloadLink.Target = "_blank";
}
}
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender (e);
if(DataSource == null || downloadLink == null)
this.Visible = false;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -