Mark Handy
Mark Handy

Reputation: 1256

Kentico Eval('DocumentType')

Is there anything that could be a problem here? I'm trying to get a document type, with out the period.

<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>

Upvotes: 0

Views: 68

Answers (1)

Tom Troughton
Tom Troughton

Reputation: 4325

TrimStart will only trim leading characters. You need dt.Replace(".", string.Empty).

Upvotes: 1

Related Questions