参加msdnms-help://MS.VSCC/MS.MSDNVS.2052/Vbcon/html/vbtskAddingControlsToWebFormsPageProgrammatically.htm

解决方案 »

  1.   

    seeCreating Templates Dynamically in a DataList Web Server Control
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbgrfcreatingtemplatecolumnsdynamicallyindatalistwebservercontrol.aspor you can define a ItemTemplate class and then do
    myDataList.ItemTemplate = new MyTemplate( ListItemType.Item );
    ...see
    http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=rMhsa.410%24XU1.79897633%40newssvr21.news.prodigy.com&rnum=3&prev=/groups%3Fq%3Ddatalist%2Bdynamic%2Bitemtemplate%26hl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26selm%3DrMhsa.410%2524XU1.79897633%2540newssvr21.news.prodigy.com%26rnum%3D3
      

  2.   

    myLabel.Text += DataBinder.Eval( dataListContainer.DataItem , "Path" );
    妙哉,我怎么没想到?哈