0

Hello I want to get only date and month in pagelayout. I edin aspx file.

This is my code:

<div class="event-date">
<span>  
    <%@ SPContext.Current.ListItem["SODigitalPageDate"] != null? (new DateTime(SPContext.Current.ListItem["SODigitalPageDate"].toString()).ToString("s") %>
 </span>  
</div> 

This is following error error:

/_catalogs/masterpage/NewsPageLayout.aspx. The server block is not well formed.

I checked this question here

1 Answer 1

2

So take a look at my answer in the question you link to:

You are using

<%@

to open the code block, the answer uses

<%=

You are also missing the : string.Empty part in the end of the line

So

<%= SPContext.Current.ListItem["SODigitalPageDate"] != null ? (new DateTime(SPContext.Current.ListItem["SODigitalPageDate"].ToString()).ToString("s") : string.Empty %>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.