0
이제 이것을 두 번 확인했습니다. 단점이 있지만 데이터가 상자에 추가되지 않고 페이지에 아무 것도 표시되지 않는 오류가 발생했습니다. ,조차 "빈"텍스트가 나타나는되지만 내가 추가 부분데이터가 드롭 다운 목록에 나타나지 않습니다.
public class BrandDropDownList : DropDownList
{
protected override void OnLoad(EventArgs e)
{
BrandListRetrieve();
base.OnLoad(e);
}
public void BrandListRetrieve()
{
var factory = new BrandFactory();
var customBool1State = factory.ByCustomBoolean1(true, CoreHttpModule.Session);
if (customBool1State != null)
{
var brandDropDown = CoreHttpModule.Session.CreateCriteria(typeof(Brand)).List<Brand>();
DropDownList brandDropDownList = new DropDownList();
foreach (Brand brand in brandDropDown)
{
brandDropDownList.Items.Add(brand.Name);
}
if (brandDropDownList.Items.Count < 0)
{
brandDropDownList.Items.Insert(0, new ListItem("Hello World", "Hello World"));
}
brandDropDownList.DataBind();
}
}
}
은 ASP.NET
<needlesports:BrandDropDownList runat="server" Visible="true" />
DropDownList에 직접 항목을 추가하기 때문에 DataBind() 단계가 필요하다고 생각하지 않습니다. – tomasmcguinness
이봐, 나는 실제로 이것을 제거했다 :) 나는 나 자신을 알아 차 렸지만 아무런 차이가없는 것처럼 보였다. –
WPF 일명 Windows Presentation Foundation이 ASP.NET Webform과 동일하지 않다는 것을 알고 계십니까? 질문에 다시 태그를 답니다. – nemesv