动态改变DataList的DataSource
我是这样做的 但是没实现效果,在线求助高手!!
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Request.QueryString["qid"] == null)
{
DataList1.DataSourceID = "SqlDataSource4";
}
else
{
DataList1.DataSourceID = "SqlDataSource1";
}
}
}
============================
if (Request.QueryString["qid"] == null)
{
DataList1.DataSourceID = "SqlDataSource4";
//加上这行试试
DataList1.DataBind();
}
else
{
DataList1.DataSourceID = "SqlDataSource1";
//加上这行试试
DataList1.DataBind();
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Request.QueryString["qid"] == null)
{
DataList1.DataSourceID = "SqlDataSource4";
}
else
{
DataList1.DataSourceID = "SqlDataSource1";
}
}
}
============================
if (Request.QueryString["qid"] == null)
{
DataList1.DataSourceID = "SqlDataSource4";
//加上这行试试
DataList1.DataBind();
}
else
{
DataList1.DataSourceID = "SqlDataSource1";
//加上这行试试
DataList1.DataBind();
}