C#源码
string SqlConString = "Data Source=(local);Initial Catalog=FTPData;Integrated Security=True"; SqlConnection con = new SqlConnection(SqlConString); con.Open(); SqlCommand cmd = new SqlCommand(CreateSQLQueryString(), con); SqlDataReader dr = cmd.ExecuteReader(); RepeaterResult.DataSource = dr; RepeaterResult.DataBind(); dr.Close(); con.Close();
aspx文件中
<asp:Repeater ID="RepeaterResult" runat="server" onitemdatabound="RepeaterResult_ItemDataBound"> <HeaderTemplate> <table> </HeaderTemplate> <ItemTemplate> <tr><td width="100%" colspan="2"><a class="result_filename"><%#HilghtKeyWord(Eval("Filename").ToString())%></a></td></tr> <tr><td width="150">文件类型:<a class="result_postfix"><%#Eval("Postfix")%></a></td>
<td>大小:<a class="result_size"><%#Eval("size") %></a>KB</td></tr> <tr><td width="100%" colspan="2">来源:<a class="result_lai"><%#GetPath(Eval("FileID").ToString())%></a></td></tr> <tr><td> </td></tr> </ItemTemplate> <FooterTemplate> </table> </FooterTemplate> </asp:Repeater>