Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在我的转发器中,我想设置如下文字的内容:
<ItemTemplate> <asp:Literal id="lit" runat="server" /> </ItemTemplte>
我在设置后面的代码中有我的 OnDataItemBound 方法。
我以前做过这个,但只是设置标签并没有真正获取正在迭代的当前行的数据。
如何获取数据和列等?
通过使用RepeaterItemEventArgsOnDataItemBound 方法,您可以通过以下方式访问您的数据对象e.Item.DataItem:
RepeaterItemEventArgs
e.Item.DataItem
void R1_ItemDataBound(Object Sender, RepeaterItemEventArgs e) { var obj = (MyObject)e.Item.DataItem; // use your object here to populate text boxes etc... }