0
同級控制我有一個Repeater
結構是這樣的:查找直放站
<asp:Repeater ID="rptListClaimTypes" runat="server">
<ItemTemplate>
<asp:FileUpload ID="fuContract" runat="server" />
<asp:LinkButton ID="btnUpload" runat="server" Text="Upload" OnClick="btnUpload_Click" CommandName='<%# Eval("ClaimTypeID")%>' />
</ItemTemplate>
</asp:Repeater>
我需要的是點擊btnUpload
時處理文件上傳。我可以通過sender
訪問觸發子程序的控件。我將如何訪問fuContract
?
Protected Sub btnUpload_Click(sender As Object, e As EventArgs)
Dim ClaimTypeID As Integer = sender.CommandName
Dim fuContract As FileUpload = '??
End Sub
這很好。我只是用一個稍微長一點的方式工作'Dim btnUpload As LinkButton = DirectCast(sender,LinkButton)'Dim rpItem As RepeaterItem = TryCast(btnUpload.NamingContainer,RepeaterItem)''Dim fuContract As FileUpload = rpItem.FindControl 「fucontract」),但是你的單行版本要好得多。非常感謝。 – Turnip