I came across a pretty weird issue. Some of my Web User Controls are causing the parent page which references it to get 404 page not found error.
Here is how I register it on the .aspx page:
<%@ Register TagPrefix="uc" TagName="DonationList"
Src="~/Controls/Donation/DonationList.ascx" %>
And the line where the user control is declared on the same aspx page:
<uc:DonationList ID="seenDonationListUC" runat="server" SeenInformation="Seen" />
If I remove the above line, I don't get a 404 error page anymore.
This is a small snippet of the user control class:
public partial class DonationList : System.Web.UI.UserControl
{
public enum Seen
{
Unspecified = 0,
Seen = 1,
NotSeen = 2
}
public Seen SeenInformation
{
get
{
int temp = seenInformationHF.Value == "" ? 0 : Convert.ToInt32(seenInformationHF.Value);
result = (Seen) temp;
return result;
}
.....
Any idea on the possible causes of this?
Name of your enum and subsequent enum value both are same "Seen". Try changing the enum name to something like SeenOptions. For example,
public enum SeenOptions
{
Unspecified = 0,
Seen = 1,
NotSeen = 2
}
In this case your SeenInformation class will look like,
public SeenOptions SeenInformation
{
get
{
int temp = seenInformationHF.Value == "" ? 0 : Convert.ToInt32(seenInformationHF.Value);
result = (Seen) temp;
}
.....
And finally, your user control line on aspx page will be same as before.
<uc:DonationList ID="seenDonationListUC" runat="server" SeenInformation="Seen" />
I hope this will fix your problem.