0
in a repeater, i want to do a function on every item bounded, example
<asp:Repeater runat="server" ID="rptArticleContent"
OnItemDataBound="rptArticleContent_ItemDataBound">
<ItemTemplate>
<tr>
<td width="365" valign="top" align="left" class="bodyContent" bgcolor="#FFFFFF">
<div>
<h2 class="h2">
<asp:Label runat="server" ID="dsds"> <%#Eval("Title") %></asp:Label>
</h2>
<div class="article-body">
<div class="Article-image">
<%#Eval("Image") %>
</div>
<%#Eval("Description") %>
</div>
<asp:Literal runat="server" ID="litArticleSource" Text='<%#Eval("Source") %>'>
</asp:Literal>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
後面我想要做的一些數據操縱的文字中繼器數據綁定,對每一個項目的某些數據的操作代碼綁定
protected void rptArticleContent_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
Literal litArticleSource = rptArticleContent.FindControl
("litArticleSource") as Literal;
string ArticleSourcesR = litArticleSource.Text;
}
ArticleSourcesR內仍給空,薩姆告訴我,當用rptArticleContent.FindControl捕捉控制信息,我應該添加一些東西,這樣它就會應用在每一個有界的項目上,那是什麼缺失的線索。應該添加什麼?
看看你自己以前的問題的答案:http://stackoverflow.com/questions/6923871/repeater-databinding-with-manipulation-of-certain-data –