protected void favFolderRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
{
Repeater favFolderFileRepeater = (Repeater)e.Item.FindControl("favFolderFileRepeater");
System.Data.Common.DbDataRecord newRow = (System.Data.Common.DbDataRecord)e.Item.DataItem;
int parentId = Convert.ToInt32(newRow["this_id"]);
//Response.Write(parentId);
string connStr = ConfigurationManager.AppSettings[0].ToString();
SqlConnection conn = new SqlConnection(connStr);
string cmdStr = "select this_id,this_title,this_url,this_tip,this_color from userFav where this_name = @this_name and parent_id=@parent_id order by order_id";
SqlCommand comm = new SqlCommand(cmdStr, conn);
comm.Parameters.AddWithValue("@this_name", User.Identity.Name);
comm.Parameters.AddWithValue("@parent_id",parentId);
conn.Open();
SqlDataReader dr = comm.ExecuteReader();
favFolderFileRepeater.DataSource = dr;
favFolderFileRepeater.DataBind();
dr.Close();
conn.Close();
}
前台:
<td width="50%" valign="top" ) %></a>
</div>
</ItemTemplate>
</asp:Repeater>
</div>
</ItemTemplate>
</asp:Repeater>
</td>