Dec 8, 2011

How to set html link visible false depending on Eval function in grid view

Below is the html link in the grid view item template that sets visibility depending on the IsOnline values.

<a href = "" style='<%# Eval("IsOnline").ToString() == "True" ? "display:block" : "display:none" %>' >link</a>

Dec 7, 2011

How to convert DateTime to Date in Linq to Entity + C#

Use EntityFunction to truncate the time part from a DateTime String.

grid.DataSource = (from user in context.Users where ISActive = True select new
                                              FirstName = (user.FirstName + " " + user.LastName),                                           
                                              CreatedDate = System.Data.Objects.EntityFunctions.TruncateTime(user.CreatedDate)