GridView Container.DataItem

asp.netgridview

A bit ashamed to ask this but, what is equivalent of Container.DataItem from DataGrid in GridView. I don't want to use Eval and I don't want to bind it to DataSource control. I want to be able to do this <%#((MyType)Container.DataItem).MyAttribute %> in template field.

SOLVED: Nevermind, it actually works, my tag was not closed in the aspx page correctly.

Best Answer

You can use Container.DataItem with a GridView - what you've got there looks fine. What error are you getting?

This link might also help: What's the deal with DataBinder.Eval and Container.DataItem?

Related Topic