我能够在 LoginView1 中找到 DetailsView
DetailsView DetailsView1 = (DetailsView)LoginView1.FindControl("DetailsView1");
上面的语句有效......但我无法在 DetailsView 中找到标签
Label id = (Label)DetailsView1.FindControl("id");
上面的语句返回我 null
这是我的aspx代码
<asp:LoginView ID="LoginView1" runat="server">
<LoggedInTemplate>
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"
DataKeyNames="FeeID" DataSourceID="SqlDataSource1" Height="50px"
Visible="False" Width="100%">
<Fields>
<asp:TemplateField HeaderText="FeeID" InsertVisible="False"
SortExpression="FeeID">
<EditItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("FeeID")%>'></asp:Label>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="id" runat="server" Text='<%# Bind("FeeID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Fields>
</asp:DetailsView>
</LoggedInTemplate>
<AnonymousTemplate>
Access Denied.
</AnonymousTemplate>
</asp:LoginView>
谁能帮我?