2011-02-03 10 views

답변

0

은 MSDN에서 데이터 바인딩 및 데이터 바인딩 가능 컨트롤을 살펴 봅니다. 귀하의 질문에 그렇게 일반적인 ...

0

datatable 또는 dataset에서 레코드를 가져 와서 드롭 다운 목록으로 바인딩하십시오.

public static void BindDropDownList(DataTable _dt, System.Web.UI.WebControls.DropDownList _ddl, bool IsDIndex,string text) 
{ 
    try 
    { 
     _ddl.DataSource = _dt; 
     _ddl.DataBind(); 

     if (IsDIndex == true) 
     { 
      _ddl.Items.Insert(0, new ListItem(text, "0")); 
     } 
    } 
    catch (Exception ex) 
    { 
     General.ErrorLog(ex.Message + " Stack Trace: " + ex.StackTrace, System.Diagnostics.EventLogEntryType.Error, "General - BindDropDownList()"); 
    } 
}