日期:2014-05-19  浏览次数:20481 次

关于datalist的问题
以下是我的绑定代码:为什么每次都只绑定了一条记录,我本来查出来有多条记录的.
<asp:DataList   id= "dlMulti "   runat= "server ">
<HeaderTemplate>
<FONT   face= "宋体 "> 二.多项选择题 </FONT>
</HeaderTemplate>
<SelectedItemTemplate>
<FONT   face= "宋体 "   color= "#000000 "> </FONT>
</SelectedItemTemplate>
<FooterTemplate>
<FONT   face= "宋体 "> </FONT>
</FooterTemplate>
<ItemTemplate>
<FONT   face= "宋体 ">
<P>
<asp:Label   id=Label1   runat= "server "   Text= ' <%#   DataBinder.Eval(Container.DataItem,   "body ")   %> '>
</asp:Label>
<asp:Image   id=Image1   runat= "server "   ImageUrl= ' <%#   DataBinder.Eval(Container.DataItem,   "imageurl ")   %> '>
</asp:Image> </P>
<P>
<asp:RadioButton   id= "RadioButton1 "   runat= "server "   Text= "A "> </asp:RadioButton>
<asp:Label   id=la   runat= "server "   Text= ' <%#   DataBinder.Eval(Container.DataItem,   "optionA ")   %> '>
</asp:Label> </P>
<P>
<asp:RadioButton   id= "RadioButton2 "   runat= "server "   Text= "B "   Width= "28px "> </asp:RadioButton>
<asp:Label   id=lb   runat= "server "   Text= ' <%#   DataBinder.Eval(Container.DataItem,   "optionB ")   %> '>
</asp:Label> </P>
<P>
<asp:RadioButton   id= "RadioButton3 "   runat= "server "   Text= "C "> </asp:RadioButton>
<asp:Label   id=lc   runat= "server "   Text= ' <%#   DataBinder.Eval(Container.DataItem,   "optionC ")   %> '>
</asp:Label> </P>
<P>
<asp:RadioButton   id= "RadioButton4 "   runat= "server "   Text= "D "> </asp:RadioButton>
<asp:Label   id=ld   runat= "server "   Text= ' <%#   DataBinder.Eval(Container.DataItem,   "optionD ")   %> '>
</asp:Label> </P>
<HR   width= "100% "   SIZE= "1 ">
<P> &nbsp; </P>
</FONT>
</ItemTemplate>
<AlternatingItemTemplate>
<FONT   face= "宋体 "> </FONT>
</AlternatingItemTemplate>
<EditItemTemplate>
<FONT   face= "宋体 "> </FONT>
</EditItemTemplate>
</asp:DataList> </P>

------解决方案--------------------
还有把你的分隔线hr放到下面模板中
<SeparatorTemplate&