PDA

Click to See Complete Forum and Search --> : [2.0] IhirearchicalDataSource datasource


r0k3t
Jul 6th, 2007, 08:10 AM
Hi there,

So I am stuck using some objects that someone else bought off the web - don't blame me I am not the boss... :) At any rate I am trying to make this slide menu thing work. I finally posted to the companies website and they told me I couldn't use SqlDataSource, they said it is not a IhirearchicalDataSource. Now I went out and researched this and I seem to understand somewhat, at least I understand what the mean. What I don't understand is how should I be implementing this? Should I not use the sqlClient classes?

I guess the big question how do I change the code below to make that work then? Have a quick look!


Connection = new SqlConnection(ConfigurationManager.ConnectionStrings["ecommerceConnectionString"].ConnectionString);
Connection.Open();
Command selectAllIndustries = new SqlCommand("GetAllIndustires", Connection);
selectAllIndustries.CommandType = CommandType.StoredProcedure;
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(selectAllIndustries);
da.Fill(ds);

SlideMenu1.DataSource = ds.Tables[0];
SlideMenu1.DataFields = "Name";
SlideMenu1.DataBind();


From the website of the objects.

"Actually your code is correct. What I was saying is for your instance, SqlDataSource won't work for SlideMenu. Which means you can not assign a SqlDataSource as SlideMenu's datasource. The reason is that SqlDataSource is not an IhirearchicalDataSource, which means our slideMenu only can work with datasource which inherits IHierarchicalDataSource interface."

So what? Do I use an OleDb data source? They just doesn't seem to make any sense...

Thanks

ComputerJy
Jul 6th, 2007, 10:32 AM
I'd drop the control, use another one (something that makes sense) or build it from scratch to meet my standards.

But you can create a class that inherits the SqlDataSource and implements IHierarchicalDataSource interface which by the way is not a .NET built-in interface. Or you can just contact them for the solution which might be the best way

But whatever you do would get you better results than asking people who don't know what are you talking about!!

jmcilhinney
Jul 6th, 2007, 08:21 PM
IHierarchicalDataSource interface which by the way is not a .NET built-in interface.Not true. It is the System.Web.UI.IHierarchicalDataSource interface. Go to the MSDN library and read about, understand it and then either use an existing class that implements it or else define your own class that implements it. It only has one method: GetHierarchicalView. You need to implement that method to get the data inside your object and return it contained in a HierarchicalDataSourceView object.