0
背景是我有一個自定義控件是一個asp:菜單鏈接到一個xmldatasource。 xmldatasource是根據用戶的privies動態創建的。以下是自定義控件的加載事件:自定義動態創建的菜單產生一些奇怪的錯誤
protected void Page_Load(object sender, EventArgs e)
{
string userId = (string)Session["userId"];
if (userId != null)
{
DataSet ds = dal.RetrieveApplications(userId);
ds.DataSetName = "Menus";
ds.Tables[0].TableName = "Menu";
DataRelation relation = new DataRelation
("ParentChild",
ds.Tables["Menu"].Columns["Folder_Id"],
ds.Tables["Menu"].Columns["Parent_Folder_ID"], true);
relation.Nested = true;
ds.Relations.Add(relation);
xmlDataSource1.Data = ds.GetXml();
}
}
這對於使用它的第一個用戶來說是完美的。但是,似乎每個後續用戶實際上都獲得了第一個用戶的菜單。我已經通過了並驗證了我的數據集創建正常,並且在加載結束時檢查XMLDatasource.data時,xml是正確的。
我真的被卡住了。