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

Forums / General Discussions / combobox as a metafield

combobox as a metafield

9 posts, 0 answered
  1. Tarun
    Tarun avatar
    81 posts
    Registered:
    14 Jan 2009
    19 Oct 2010
    Link to this post
    Hi,

    I implemented a GC Module and now want to add a combobox as a metafield in the "NewView" and "EditView" as like in below link.

    and want this box a load-on-demand combobox of usernames like these?
    http://demos.telerik.com/aspnet-ajax/combobox/examples/populatingwithdata/autocompletesql/defaultcs.aspx


    Thanks,
    Tarun
     
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    19 Oct 2010
    Link to this post
    Hi Tarun,

    You need to create a custom control that wraps RadComboBox and this control should implements ITextControl. Then you have to bind your control the the datasource you are going to use. Finally declare the custom control inside ContentMetaFields control declared inside ItemNew and ItemEdit templates of the module you are going to use. When your custom control implements ITextControl the data will be automatically persisted by ContentMetaFields control.

    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
    19 Oct 2010
    Link to this post
    Thanks Ivan for quick reply!

    Do you have any sample or direct me how would this combobox will be binded on page.How would I access this combobox on ItemNew.cs page?

    Regards,
    Tarun


  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    19 Oct 2010
    Link to this post
    Hello Tarun,

    You could take a look at

    How to implement a drop down list or a radio button list as a meta field

    You can access your control from the code behind of the templates (How to map a template) you want to modify by using ContentMetaFields controls collection.

    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
    19 Oct 2010
    Link to this post
    Hi Ivan,

    I did not found any External template.Zip. I am using Sitefinity3.7. Could you please give me link for download. 

    This looks so complex adding combobox as a metafield.

    Thanks,
    Tarun
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    19 Oct 2010
    Link to this post
    Hi Tarun,

    The templates are located in Downloads section of your account. Please check it.

    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
  7. Tarun
    Tarun avatar
    81 posts
    Registered:
    14 Jan 2009
    20 Oct 2010
    Link to this post
    Hi Ivan,

    AS I said I have implemented Custom module so I have my own template "ItemNew" or "ItemEdit" then what is the need of external template. Do I need them?

    Please let me know how to access combobox control from the code behind of the templates and how to modify by using ContentMetaFields controls collection.

    Thanks,
    Tarun
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    20 Oct 2010
    Link to this post
    Hello Tarun,

    You can access the combo box from the base container by creating a public property inside your view.

    sample

    protected virtual RadComboBox Combo
          {
              get
              {
                  return base.Container.GetControl<RadComboBox>("controlid", true, TraverseMethod.BreadthFirst);
              }
          }

    another option is getting the ContentMetaFields and then looping through its controls collection

    protected virtual IContentCategoriesField CategoriesControl
          {
              get
              {
                  return (IContentCategoriesField)base.Container.GetControl<Control>("Category", false, TraverseMethod.BreadthFirst);
              }
          }


    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
  9. Tarun
    Tarun avatar
    81 posts
    Registered:
    14 Jan 2009
    22 Oct 2010
    Link to this post
    Thank you Ivan for your help !


Register for webinar
9 posts, 0 answered