C# ASCX control inline functions

Date: 2018-01-02
<div class="column col-xs-2">
    <a href="<%# GetDocumentUrl(Eval("DocumentID")) %>">
        <%# GetImage() %>
            <p>
                <%# GetTitle() %>
            </p>
    </a>
</div>

<script runat="server">
    string GetImage() {
        var imageUrl = Eval<string>("NavigationIcon");
        if (String.IsNullOrEmpty(imageUrl))
            return;
        return "<img style=\"margin: 0 auto;width:auto;max-height:200px;\" class=\"img-responsive\" alt=\"\"" +
            String.Format("title=\"\" src=\"{0}\">", imageUrl);
    }

    string GetTitle() {
        var title = Eval<string>("DocumentName")
        if (IsCurrentDocument()) {
            return String.Format("<b>{0}</b>", title);
        }
        return title;
    }
</script>
9780cookie-checkC# ASCX control inline functions