I have create method in master page and bind in radmenu control:
Here is the Code that I get the table from session and bind
public void ShowMenuItems()
{
try
{
if (common.myStr(Session["MenuData"]) != "")
{
DataTable ds = (DataTable)Session["MenuData"];
if (ds != null)
{
if (ds.Rows.Count > 0)
{
for (int ii = 0; ii < ds.Rows.Count; ii++)
{
if (common.myInt(ds.Rows[ii]["ParentId"]) == 0)
{
ds.Rows[ii]["ParentId"] = DBNull.Value;
ds.AcceptChanges();
}
}
ds.DefaultView.Sort = "";
ds.DefaultView.RowFilter = "ModuleId =" + common.myInt(Session["ModuleId"]);
ds.DefaultView.Sort = "Sequence Asc";
if (ds.DefaultView.Count > 0)
{
RadMenu1.DataSource = ds.DefaultView;
//Establish hierarchy:
RadMenu1.DataFieldID = "PageId";
RadMenu1.DataFieldParentID = "ParentId";
//Set Text, Value, and NavigateUrl:
RadMenu1.DataTextField = "PageName";
RadMenu1.DataValueField = "PageId";
RadMenu1.DataNavigateUrlField = "PageUrl";
RadMenu1.DataBind();
}
}
}
}
}
catch (Exception Ex)
{
objException.HandleExceptionWithMethod(Ex, "ShowMenuItems");
}
}
And following Error Occur in ourt database exception log table
(ShowMenuItems)This constraint cannot be enabled as not all values have corresponding parent values.
Please why this error come
Please help me I am helpless
Thanks
Here is the Code that I get the table from session and bind
public void ShowMenuItems()
{
try
{
if (common.myStr(Session["MenuData"]) != "")
{
DataTable ds = (DataTable)Session["MenuData"];
if (ds != null)
{
if (ds.Rows.Count > 0)
{
for (int ii = 0; ii < ds.Rows.Count; ii++)
{
if (common.myInt(ds.Rows[ii]["ParentId"]) == 0)
{
ds.Rows[ii]["ParentId"] = DBNull.Value;
ds.AcceptChanges();
}
}
ds.DefaultView.Sort = "";
ds.DefaultView.RowFilter = "ModuleId =" + common.myInt(Session["ModuleId"]);
ds.DefaultView.Sort = "Sequence Asc";
if (ds.DefaultView.Count > 0)
{
RadMenu1.DataSource = ds.DefaultView;
//Establish hierarchy:
RadMenu1.DataFieldID = "PageId";
RadMenu1.DataFieldParentID = "ParentId";
//Set Text, Value, and NavigateUrl:
RadMenu1.DataTextField = "PageName";
RadMenu1.DataValueField = "PageId";
RadMenu1.DataNavigateUrlField = "PageUrl";
RadMenu1.DataBind();
}
}
}
}
}
catch (Exception Ex)
{
objException.HandleExceptionWithMethod(Ex, "ShowMenuItems");
}
}
And following Error Occur in ourt database exception log table
(ShowMenuItems)This constraint cannot be enabled as not all values have corresponding parent values.
Please why this error come
Please help me I am helpless
Thanks