Technical support This forum is closed.
Version 1.x > Technical support > Error when tried to import using treenode View modes: 
User avatar
Member
Member
rahemeen - 5/15/2006 11:12:05 AM
   
Error when tried to import using treenode
dear administrator plz reply soon
i created Products MenuItem from cmsdesk

/Home
/About
/Products

and wrote code as u said using treenode

but when i run the code following error coming
plz let me know what changes i need to do.

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 31: trNode.SetValue("MenuItemType", 1)
Line 32: trNode.SetValue("MenuItemHideInNavigation", 0)
Line 33: trNode.Insert("/product", TreePathTypeEnum.AliasPath)
Line 34: rs.MoveNext()
Line 35: End While


Source File: C:\Inetpub\wwwroot\KenticoCMS1\ExcelSelect.aspx.vb Line: 33


User avatar
Member
Member
Martin_Kentico - 5/19/2006 2:50:17 PM
   
Re: Error when tried to import using treenode
Hello,

Thank you for your post.

I am not sure what your detailed code is, but I guess the error occurs because you are trying to insert the new node into the "/product" instead of the "/products" path, the path where you insert the node must be an existing document path.

If this didn't help, pleas post the whole method code you are using

Best regards

User avatar
Member
Member
rahemeen - 5/24/2006 7:47:32 PM
   
Re: Error when tried to import using treenode
still the same problem
i am reading from excel and if i display in

Label1.text= cstr(dr(0)) ' showing value ok

node.insert( "/products/" & cstr(dr(0)), TreePathTypeEnum.AliasPath) ' here giving error and raising NullReferenceException

i dont know why plz clear this prob.

thanx dear

User avatar
Guest
martin_kentico - 5/24/2006 10:45:12 PM
   
Re: Error when tried to import using treenode
Hello,

Could you please post the whole code that you use for creating the document? (All since the "node" variable is defined until the "node.insert(...)" line)

Best Regards