using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
SqlConnection sqlcon;
string strCon = "Data Source=(local);Database=master;Uid=sa;Pwd=sa";
public void Page_Load(object sender, EventArgs e)
{
string sqlstr = "select * from test";
sqlcon = new SqlConnection(strCon);
SqlDataAdapter myda = new SqlDataAdapter(sqlstr, sqlcon);
DataSet myds = new DataSet();
sqlcon.Open();
myda.Fill(myds, "表");
repeaterParent.DataSource = myds;
repeaterParent.DataBind();
sqlcon.Close();
}
protected void repeaterParent_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
int MenuId = Convert.ToInt32(((DataRowView)e.Item.DataItem).Row["orderid"]);
Repeater repeaterMinMenu = (Repeater)e.Item.FindControl("repeaterMinMenu");
if (repeaterMinMenu != null)
{
string SqlGetMinMenu = "select * from test where orderid=" + MenuId;
sqlcon = new SqlConnection(strCon);
SqlDataAdapter myda = new SqlDataAdapter(SqlGetMinMenu, sqlcon);
DataSet myds = new DataSet();
sqlcon.Open();
myda.Fill(myds, "表");
repeaterMinMenu.DataSource = myds;
repeaterMinMenu.DataBind();
sqlcon.Close();
}
}
}
}