Binding to Hierarchical Data Source (FAQs)

Discussion in 'ASP .Net' started by Kent Boogaart, Feb 1, 2006.

  1. Hi,

    I have some hierarchical data (FAQs) that I would like to bind to. The basic
    structure is:

    FAQ Category
    + Categories
    + FAQs

    So an FAQ category has any number of sub-categories and any number of FAQs.
    I want to display this structure on a web page so that it looks something
    like this:

    FAQ Category 1
    FAQ 1.1
    FAQ 1.2
    FAQ Category 2
    FAQ 2.1
    FAQ 2.2
    FAQ Category 2.1
    FAQ 2.1.1

    etcetera. I am confused about how to do this though. Firstly, I don't want
    to use the XmlDataSource since my structure is not in XML. So I figured I'd
    write my own FAQDataSource. Even if I do that though, which control should I
    use to display this? The tree control doesn't allow me to customise the
    display enough (no templates). The menu control doesn't allow me to
    customise leaf nodes (FAQs) and non-leaf nodes (FAQ categories) separately.

    Is there some other control I should be using for this? I thought about
    using GridViews recursively but am not sure whether that's a good option...

    Please advise,
    Kent
     
    Kent Boogaart, Feb 1, 2006
    #1
    1. Advertising

  2. Kent,
    You could write a class that inherits from HierarchicalDataSourceControl
    Then bind to a treeview this is Kindof advanced but there's an example to
    display the file system in vs 2005 help
    http://msdn2.microsoft.com/en-us/library/system.web.ui.hierarchicaldatasourcecontrol.aspx

    Good Luck
    DWS


    "Kent Boogaart" wrote:

    > Hi,
    >
    > I have some hierarchical data (FAQs) that I would like to bind to. The basic
    > structure is:
    >
    > FAQ Category
    > + Categories
    > + FAQs
    >
    > So an FAQ category has any number of sub-categories and any number of FAQs.
    > I want to display this structure on a web page so that it looks something
    > like this:
    >
    > FAQ Category 1
    > FAQ 1.1
    > FAQ 1.2
    > FAQ Category 2
    > FAQ 2.1
    > FAQ 2.2
    > FAQ Category 2.1
    > FAQ 2.1.1
    >
    > etcetera. I am confused about how to do this though. Firstly, I don't want
    > to use the XmlDataSource since my structure is not in XML. So I figured I'd
    > write my own FAQDataSource. Even if I do that though, which control should I
    > use to display this? The tree control doesn't allow me to customise the
    > display enough (no templates). The menu control doesn't allow me to
    > customise leaf nodes (FAQs) and non-leaf nodes (FAQ categories) separately.
    >
    > Is there some other control I should be using for this? I thought about
    > using GridViews recursively but am not sure whether that's a good option...
    >
    > Please advise,
    > Kent
    >
    >
    >
     
    =?Utf-8?B?RFdT?=, Feb 1, 2006
    #2
    1. Advertising

  3. As there is no class that supports your structure directly, you are going to
    have to create your own mechanism to either a) turn into a type of structure
    that is supported by databinding or b) write your own parser and display
    elements.

    DWS has a decent suggestion. Conversion of your material to XML is another
    decent option (allows storage in the method you current have, but binds as
    XML).

    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA

    ***************************
    Think Outside the Box!
    ***************************


    "Kent Boogaart" wrote:

    > Hi,
    >
    > I have some hierarchical data (FAQs) that I would like to bind to. The basic
    > structure is:
    >
    > FAQ Category
    > + Categories
    > + FAQs
    >
    > So an FAQ category has any number of sub-categories and any number of FAQs.
    > I want to display this structure on a web page so that it looks something
    > like this:
    >
    > FAQ Category 1
    > FAQ 1.1
    > FAQ 1.2
    > FAQ Category 2
    > FAQ 2.1
    > FAQ 2.2
    > FAQ Category 2.1
    > FAQ 2.1.1
    >
    > etcetera. I am confused about how to do this though. Firstly, I don't want
    > to use the XmlDataSource since my structure is not in XML. So I figured I'd
    > write my own FAQDataSource. Even if I do that though, which control should I
    > use to display this? The tree control doesn't allow me to customise the
    > display enough (no templates). The menu control doesn't allow me to
    > customise leaf nodes (FAQs) and non-leaf nodes (FAQ categories) separately.
    >
    > Is there some other control I should be using for this? I thought about
    > using GridViews recursively but am not sure whether that's a good option...
    >
    > Please advise,
    > Kent
    >
    >
    >
     
    =?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN, Feb 1, 2006
    #3
  4. Thanks guys. Actually, I already started down the path of implementing my
    own data source. Then I thought "which control will I use to display the
    data?". As I mentioned, the tree control isn't flexible enough for me (no
    templates) and the menu control doesn't allow different templates for leaf /
    non-leaf nodes (in other words, I can't display the FAQ category differently
    to the FAQ, which is obviously required).

    So assuming I have my custom data source, do you have a suggestion for which
    control I could use to display it?

    Thanks,
    Kent

    "Cowboy (Gregory A. Beamer) - MVP" <> wrote
    in message news:...
    > As there is no class that supports your structure directly, you are going
    > to
    > have to create your own mechanism to either a) turn into a type of
    > structure
    > that is supported by databinding or b) write your own parser and display
    > elements.
    >
    > DWS has a decent suggestion. Conversion of your material to XML is another
    > decent option (allows storage in the method you current have, but binds as
    > XML).
    >
    > --
    > Gregory A. Beamer
    > MVP; MCP: +I, SE, SD, DBA
    >
    > ***************************
    > Think Outside the Box!
    > ***************************
    >
    >
    > "Kent Boogaart" wrote:
    >
    >> Hi,
    >>
    >> I have some hierarchical data (FAQs) that I would like to bind to. The
    >> basic
    >> structure is:
    >>
    >> FAQ Category
    >> + Categories
    >> + FAQs
    >>
    >> So an FAQ category has any number of sub-categories and any number of
    >> FAQs.
    >> I want to display this structure on a web page so that it looks something
    >> like this:
    >>
    >> FAQ Category 1
    >> FAQ 1.1
    >> FAQ 1.2
    >> FAQ Category 2
    >> FAQ 2.1
    >> FAQ 2.2
    >> FAQ Category 2.1
    >> FAQ 2.1.1
    >>
    >> etcetera. I am confused about how to do this though. Firstly, I don't
    >> want
    >> to use the XmlDataSource since my structure is not in XML. So I figured
    >> I'd
    >> write my own FAQDataSource. Even if I do that though, which control
    >> should I
    >> use to display this? The tree control doesn't allow me to customise the
    >> display enough (no templates). The menu control doesn't allow me to
    >> customise leaf nodes (FAQs) and non-leaf nodes (FAQ categories)
    >> separately.
    >>
    >> Is there some other control I should be using for this? I thought about
    >> using GridViews recursively but am not sure whether that's a good
    >> option...
    >>
    >> Please advise,
    >> Kent
    >>
    >>
    >>
     
    Kent Boogaart, Feb 1, 2006
    #4
  5. Kent Boogaart

    Rote Rote Guest

    Rote Rote, Feb 2, 2006
    #5
  6. Kent Boogaart

    Guest

    Kent,

    I think a Grid Control that supports Hierarchical data is ideal for
    you.

    Essential Grid for ASP.Net from Syncfusion could be the right control
    for you. It's not free though.

    Take a look at the heirarchical grid samples here:
    http://www2.syncfusion.com/2.0/samples.aspx

    .... and browse to Grid.Grouping.Web/Hierarchies node on the left.

    In ASP.Net 1.1, it's very easy to bind the grid to your data sources.
    Just setup the heirarchical relationship between your sql tables in the
    DataSet and bind that DataSet to the grid.

    In ASP.Net 2.0, you will have to setup the relationship in code though,
    since there is no design time support for DataSet. Still, very easy to
    set it up.

    Contact our support if you have more questions.

    Regards,
    Praveen Ramesh
    Syncfusion, Inc.
    www.syncfusion.com
     
    , Feb 2, 2006
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. neverstill

    Binding hierarchical data

    neverstill, Dec 8, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    1,203
    Anders Borum
    Dec 9, 2003
  2. Jordan
    Replies:
    2
    Views:
    2,538
    Jordan
    Feb 10, 2004
  3. Dave Kuhlman
    Replies:
    2
    Views:
    245
    A.M. Kuchling
    Sep 7, 2006
  4. Iain

    Hierarchical binding in a WebServer Control with templates

    Iain, Jun 15, 2004, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    139
    John Saunders
    Jun 15, 2004
  5. JcFx
    Replies:
    0
    Views:
    281
Loading...

Share This Page