I have following code in my Master Page C# Code. Its just throwing me error on "RadMenu1.DataSource = MenuCreation.ExecuteNonQuery();"
that Object Reference not found. This code does work elsewhere but just not working in Master Site. Can someone help. How can I use RadMenu in my master site
my stored procedure name is AllMenu which basically select all data from table name MyMenus
Also my stored procedure sql is simple. it is "SELECT id, text, (CASE WHEN parentid = 0 THEN NULL ELSE parentid END) FROM MyMenus"
SqlCommand MenuCreation= new SqlCommand();
SqlConnection dbconnection = new SqlConnection(ConfigurationManager.ConnectionStrings["SQLDB"].ConnectionString);
MenuCreation.Connection = dbconnection ;
MenuCreation.CommandType = CommandType.StoredProcedure;
MenuCreation.CommandText = "AllMenu";
ConnectionState previousConnectionState = dbconnection.State;
dbconnection.Open();
RadMenu1.DataSource = MenuCreation.ExecuteNonQuery();
RadMenu1.DataFieldID = "ID";
RadMenu1.DataFieldParentID = "ParentID";
RadMenu1.DataTextField = "Text";
RadMenu1.DataValueField = "ID";
RadMenu1.DataNavigateUrlField = "URL";
RadMenu1.DataBind();
that Object Reference not found. This code does work elsewhere but just not working in Master Site. Can someone help. How can I use RadMenu in my master site
my stored procedure name is AllMenu which basically select all data from table name MyMenus
Also my stored procedure sql is simple. it is "SELECT id, text, (CASE WHEN parentid = 0 THEN NULL ELSE parentid END) FROM MyMenus"
SqlCommand MenuCreation= new SqlCommand();
SqlConnection dbconnection = new SqlConnection(ConfigurationManager.ConnectionStrings["SQLDB"].ConnectionString);
MenuCreation.Connection = dbconnection ;
MenuCreation.CommandType = CommandType.StoredProcedure;
MenuCreation.CommandText = "AllMenu";
ConnectionState previousConnectionState = dbconnection.State;
dbconnection.Open();
RadMenu1.DataSource = MenuCreation.ExecuteNonQuery();
RadMenu1.DataFieldID = "ID";
RadMenu1.DataFieldParentID = "ParentID";
RadMenu1.DataTextField = "Text";
RadMenu1.DataValueField = "ID";
RadMenu1.DataNavigateUrlField = "URL";
RadMenu1.DataBind();