博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

在DataList绑定数据

Posted on 2008-10-27 22:55  Anna Yang  阅读(1769)  评论(0编辑  收藏  举报

DataList中绑定数据的代码如下:

 

 <asp:DataList ID="DataList1" runat="server" Height="1px" Width="159px" 
                        OnItemCommand
="DataList1_ItemCommand" 
                        onselectedindexchanged
="DataList1_SelectedIndexChanged">
                        
<ItemTemplate>
                            
<table border="0" cellspacing="0" class="txt" style="width: 712px; height: 20px; padding-left: 0px; margin-left: 0px; margin-top: 0px; padding-top: 0px; ">
                                
<tr>
                                    
<td align="right" style="width: 97px; height: 21px">
                                    
</td>
                                    
<td align="right" style="width: 37px; height: 21px; background-image: url(image/seach/dian.GIF);">
                                    
</td>
                                    
<td align="left" style="width: 90px; height: 21px;border-bottom: 1px dashed #000000;">
                                        『
                                          
<%# DataBinder.Eval(Container.DataItem,"type")%>
                                        』
</td>
                                    
<td align="left" style="height: 21px;border-bottom: 1px dashed #000000;">
                                        
<asp:LinkButton ID="LinkButton1" runat="server" CommandName="select"><%# DataBinder.Eval(Container.DataItem,"title"%></asp:LinkButton></td>
                                
</tr>
                            
</table>
                        
</ItemTemplate>
                        
<HeaderStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
                            Font-Underline
="False" ForeColor="red" HorizontalAlign="Center" />
                    
</asp:DataList>