Hello~
I have a WebDataMenu1 in MasterPage, I give dynamic item with under code, but last item disappear, I must add a empty item, and last item (from datasoruce) will be appeare.How can I fix it? thx.
Master.csprotected void Page_Load(object sender, EventArgs e){ SetMenu(); // WebDataMenuMain.Items.Add(""); // when I add this line, the last item will can be appeare}private void SetMenu(){ DataTable dt = GetData(); // GetData result structure is a DataTable(Columns: ID, Name, ParentID) DataSet ds = new DataSet(); ds.Tables.Add(dt); ds.Relations.Add("NodeRelation", ds.Tables[0].Columns["ID"], ds.Tables[0].Columns["ParentID"]); foreach (DataRow dr in dt.Rows) { if (dr["ParentID"] == DBNull.Value) { DataMenuItem newItem = new DataMenuItem(); newItem.Text = dr["Name"].ToString().Trim(); newItem.Key = dr["ID"].ToString().Trim(); WebDataMenuMain.Items.Add(newItem); } }}
Hello Su Min,
Your code seems to be correct. In order to be able to investigate this issue, I would need a running sample, reroducing this behavior. Thank you.
Hi Su Min,
If you still need assistance with the matter, please let me know.
Hi Nikolay,
I found last item disappeared reasons: because my browser display scaling to 125%