Hi I have a datalist as follows:
<asp:DataList CssClass="courseNameInfo" ID="CourseData" runat="server" DataSourceID="CourseNameSQL">
<ItemTemplate>
<strong> Course Name:</strong><br />
<asp:Label ID="CourseLabel" runat="server" Text='<%# Eval("Course") %>'></asp:Label>
</ItemTemplate>
</asp:DataList>
I am trying to gt the labels value into my download button click event, This is what I tried:
Label lbl = (Label)CourseData.Items[0].FindControl("CourseLabel");
However, I am getting an error message saying:
Cannot convert type 'System.Web.UI.Control' to System.Reflection.Emit.Label
How would I get the label any ideas? Thanks
Aucun commentaire:
Enregistrer un commentaire