我需要訪問列表視圖中的標籤控件,當我點擊一個按鈕(即在同一行)...一旦單擊按鈕(ASP.NET c#),如何訪問ListView中的控件?
有誰知道如何做到這一點,請嗎? :(
請參閱以下更多的有識之士...
ASPX頁面:
<asp:ListView ID="ListView1" runat="server" DataSourceID="DataSource">
<LayoutTemplate>//Etc </LayoutTemplate>
<ItemTemplate>
<asp:Label ID="lblDone" runat="server" Visible="false">Your vote has been counted</asp:Label>
<asp:Button ID="voteButton" runat="server" Text="Vote" CommandArgument='<%#Eval("id") %>'
OnClick="voteOnThis" />
</ItemTemplate>
代碼背後:
protected void voteOnThis(object sender, EventArgs e)
{
Button myButton = (Button)sender;
Voting.vote(int.Parse(myButton.CommandArgument));
// Here i would like to access the 'label' lblDone and make this Visible
}
@Ian:謝謝你完成。 :) – Saar 2009-11-26 14:39:19
這是完美的歡呼聲給你們倆! – Stephen 2009-11-26 14:54:04