+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / bind category on demand

bind category on demand

6 posts, 0 answered
  1. Tarun
    Tarun avatar
    81 posts
    Registered:
    14 Jan 2009
    12 Jan 2011
    Link to this post
    HI,

    Is there any way we can bind category in combobox  like below link
    http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/filteringcombo/defaultcs.aspx

    I have created a custom control but don't want to add any sql query,only want to use your sitefinity API for this but not getting how to apply like operator for binding categories. 

    Any help will be very appreciated.

    Thanks,
    TArun 
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    12 Jan 2011
    Link to this post
    Hi Tarun,

    Categories are hierarchical structure, so it is better to use template for the RadComboBox control.

    The ContentManager class has a method GetCategories that you can use to get a list of all categories. There is another method GetCategoriesTree which you can use to get the parent categories. Another option ( if you are going to use RadTreeView ) is shown below.

    this.CategoriesTreeView.DataTextField = "CategoryName";
    this.CategoriesTreeView.DataFieldID = "ID";
    this.CategoriesTreeView.DataValueField = "ID";
    this.CategoriesTreeView.DataFieldParentID = "ParentCategoryID";
    this.CategoriesTreeView.DataSource = filteredList;
    this.CategoriesTreeView.NodeDataBound +=new Telerik.Web.UI.RadTreeViewEventHandler(CategoriesTreeView_NodeDataBound);
    this.CategoriesTreeView.DataBind();


    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Tarun
    Tarun avatar
    81 posts
    Registered:
    14 Jan 2009
    12 Jan 2011
    Link to this post
    Thank you for your reply!

    I understand what you said but as I have written that I have created a custom control for this so I was able to get categories list but I need to apply like operator(like search) which bind comobox on demand .

    Bind comobox with category as combobox bind in given url( telerik demo site)

    Looking forward for you quick response.

    Regards,
    Tarun
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    12 Jan 2011
    Link to this post
    Hello Tarun,

    You can use MetaSearchInfo with SearchCondition.Like. Another option is working with LINQ.
    You can take a look at Finding Content Items

    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Tarun
    Tarun avatar
    81 posts
    Registered:
    14 Jan 2009
    12 Jan 2011
    Link to this post
    Thank you for instant response!

    I need category list not content so I believe "MetaSearchInfo" will not work here.Can you give me bit idea or sample for this how to use your API with Linq.

    Regards,
    Tarun
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    12 Jan 2011
    Link to this post
    Hi Tarun,

    OK, yes you need to ICategory item only.  Here is some solution to get the items with LINQ. You have to use StartsWith, EndsWith, Contains, Equals etc.


    var contentManager = new ContentManager();
    var cont = contentManager.GetCategories().Cast<ICategory>().Where(c => c.CategoryName.Contains("someval"));
    var start = contentManager.GetCategories().Cast<ICategory>().Where(c => c.CategoryName.StartsWith("someval"));
    var end = contentManager.GetCategories().Cast<ICategory>().Where(c => c.CategoryName.EndsWith("someval"));
    var eq =contentManager.GetCategories().Cast<ICategory>().Where(c => c.CategoryName.Equals("someval"));


    Regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Register for webinar
6 posts, 0 answered