나는 새로운 프로젝트를 시작하고 있으며, 정말 이상한 일들이 일어나고 있습니다.왜 내 Repeater는 코드 뒤에 null입니까?
ASP.NET 3.5, VS2008.
VS를 닫고 VS를 닫고 다시 시도했지만 svn에서 다시 가져 오지만 왜 다음에있는 repeater가 null인지 이해할 수 없습니다.
나는 이것이 머리가 될 순간임을 알았다. 도와 줘?
마크 업 :
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="GalleryControl.ascx.cs" Inherits="Site.UserControls.GalleryControl" %>
<asp:Repeater ID="rptGalleries" runat="server">
<HeaderTemplate><ul></HeaderTemplate>
<ItemTemplate>
<li>wqe</li>
</ItemTemplate>
<FooterTemplate></ul></FooterTemplate>
</asp:Repeater>
코드
public partial class GalleryControl : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
rptGalleries.DataSource = new[] {1, 2, 3, 4, 5};
rptGalleries.DataBind();
}
}
뒤에 디자이너 :
public partial class GalleryControl {
/// <summary>
/// rptGalleries control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Repeater rptGalleries;
}
왜 내 중계기 널? F가 무슨 일을하고있는거야?
<ux:GalleryControl runat="server" ID="uxGalleryControl"/>
의 Web.config (나는 전에이 일을 해본 적이 있지만, 내 masterpage 다른 사용자 정의 컨트롤을 찾지 못하는 불평했다)이 있습니다
참조하는 페이지는이 있습니다.
<add tagPrefix="ux" namespace="Site.UserControls" assembly="Site" />
매우 이상합니다. .aspx.designer.cs 파일에서 리피터 제어를 확인 했습니까? 어쩌면 어떤 이유로 디자이너가 참조를 자동 생성하지 못했을까요? 필자는 전에 그런 일이 일어난 것을 보았습니다. – RPM1984
예, 있습니다. 업데이트 된 질문. –
저는 같은 효과로 완전히 새로운 컨트롤을 만들려고했습니다. 이 페이지를 참조하는 페이지에는 DropDownList가 있습니다. –