2016-11-09 5 views
0

ここに問題がありますか?私は、期間を除いて、ドキュメントタイプを取得しようとしています。Kentico評価( 'DocumentType')

<script runat="server"> 
 
    // we need to remove the . from the DocumentType 
 
    
 
    public string dt; 
 
    
 
    protected override void OnDataBinding(EventArgs e){ 
 
    dt = Eval("DocumentType").ToString(); 
 
    dt = dt.TrimStart('.'); 
 
    } 
 
</script> 
 

 
<li> 
 
    <p class='title'><a href='<%# GetDocumentUrl() %>' target='_blank' class='type-<%# dt %>' data-name='<%# Eval("FileName") %>'><%# Eval("FileName") %></a></p> 
 
    <p class='description'><%# Eval("FileDescription") %></p> 
 
    <a href='<%# GetDocumentUrl() %>' target='_blank' class='btn btn-chevron type-<%# dt %>' data-name='<%# Eval("FileName") %>'>Download</a> 
 
</li>

答えて

1

TrimStartのみ先行文字をトリムします。 dt.Replace(".", string.Empty)が必要です。

+0

ありがとうございました! dotNetは私の強い訴訟ではありません:) –