0
如何将GridView中的DataItem“AmountCollected”更改为代码背后的其他内容。我想根据某些条件将DataItem更改为Balance,并且我想知道它是否可以完成?这是使用VS 2005使用C#和HTML。在代码后面更改GridView的DataItem - 可能吗?
在此先感谢!
<asp:TemplateField ItemStyle-Width="70" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
$<asp:Label ID="lblTotalCollected" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"AmountCollected") %>'></asp:Label>
</ItemTemplate>
你能告诉我MyClass在这里到底是什么? – Ram
这是你绑定到你的'GridView'的任何东西。意思是说,你可能调用了一些代码,比如'myGridView.DataSource = myList;',其中'myList'的类型是'List'。 RowDataBound事件中行的'DataItem'是该列表中的单个项目。如果你绑定了一个'DataSet',那么'DataItem'将会是'DataRow'类型。 –
有你..谢谢你的时间! :-) – Ram