String concatination in properties when DataBinding

posted in: Uncategorized | 0

BronwenWeeGo.jpgEver use a repeater or a grid view an can’t remember how to append some other string to the databound value and finding it hard to search for? I always forget the syntax for this one..don’t know why, it’s just one of those things I always have to look up.

Normally when i just need the value straight from the item i use one of Bind or DataBinder.Eval :

Text='<%#Bind("Name") %>'
Text='<%#DataBinder.Eval(Container.DataItem, "Name) %>'

When i need to do some sort of additional string formatting, then I need to use Eval:

Text='<%#Eval("Name", "FullName: {0}")%>'