请问我这个子repeater控件repeater2 怎么读取不出数据来
protectedvoidRepeater1_ItemDataBound(objectsender,RepeaterItemEventArgse){if(e.Item.I...
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
Repeater child = (Repeater)e.Item.FindControl("Repeater2") as Repeater;
DataRowView row = (DataRowView)e.Item.DataItem;
string first = row["first"].ToString();
int parentClassID =Convert.ToInt32( row["id"].ToString ());
string sql_str = "select * from goods_second where first='"+first+"' ";
SqlConnection con = newdb.createCon();
SqlDataAdapter ad = new SqlDataAdapter(sql_str, con);
DataSet ds = new DataSet();
ad.Fill(ds, "table");
child.DataSource = ds.Tables["table"];
child.DataBind();
}
} 展开
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
Repeater child = (Repeater)e.Item.FindControl("Repeater2") as Repeater;
DataRowView row = (DataRowView)e.Item.DataItem;
string first = row["first"].ToString();
int parentClassID =Convert.ToInt32( row["id"].ToString ());
string sql_str = "select * from goods_second where first='"+first+"' ";
SqlConnection con = newdb.createCon();
SqlDataAdapter ad = new SqlDataAdapter(sql_str, con);
DataSet ds = new DataSet();
ad.Fill(ds, "table");
child.DataSource = ds.Tables["table"];
child.DataBind();
}
} 展开
1个回答
2012-05-05
展开全部
会不会放错地方了,比如说应该放在default里结果你放到了母版页里。。。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询