Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Olá a todos, estou seguindo este tutorial:
http://jobs.aspalliance.com/822_Building_a...using_ASPNET_20
e este é meu código:
protected void Page_Load(object sender, EventArgs e)
{
if (!(IsPostBack))
{
criaMenu();
}
}
public void criaMenu()
{
DataSet ds = new DataSet();
BLMenus objBLMenus = new BLMenus();
ds = objBLMenus.listaMenus();
ds.DataSetName = "Menus";
ds.Tables[0].TableName = "Menu";
DataRelation relation = new DataRelation("ParentChild",
ds.Tables["Menu"].Columns["men_codigo"],
ds.Tables["Menu"].Columns["men_parentcod"], true);
relation.Nested = true;
ds.Relations.Add(relation);
if (ds.GetXml() != null)
{
xmlDataSource = ds.GetXml();
}
}olha o erro abaixo:
Server Error in '/' Application.
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 43: objXMl.XPath = "MenuItems/MenuItem";
Line 44:
Line 45: menu.DataSource = objXMl;
Line 46: menu.DataBind();Line: 45Estou usando ele numa master page.
Carregando comentários...