The background is I have a custom control that is a asp:Menu that is linked to an xmldatasource. The xmldatasource is created dynamically depending on the user privies. Here is the load event for the custom control:
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(); } }
This works perfectly for the first user that uses it. But it seems that every subsequent user is actually getting the first user’s menu. I have walked it through and verified that my dataset is getting created fine and when I examine the XMLDatasource.data at the end of the load the xml is correct.
I am really stuck.
I found the answer and though I would leave it out here for others who might search for this:
But I had to set the ‘ENABLECACHING’ to false on the xmldatasource.