typeable ComboBox in radFilter

7 posts, 0 answers
  1. rik butcher
    rik butcher avatar
    106 posts
    Member since:
    Jul 2009

    Posted 24 Jun 2013 Link to this post

    hey - i have a custom filter for combox in a telerik filter  that i'd like to be typeable.
    it's built in to the other radComboboxes:
    can you suggest anything that i could use to make this possible - below is part of that initialize of the class:
    i tried using [comboBox.EnableLoadOnDemand = true;] - but i dont know how to refernce the Object DataSouce to pick what's being typed in the filter ComboBox.
    mark up is included:

     

     

    <telerik:RadFilter ID="InventoriesRadFilter" runat="server" Skin="WebBlue" ShowApplyButton="true"

     

     

     

    OnPreRender="InventoriesRadFilter_PreRender" OnApplyExpressions="InventoriesRadFilter_Apply"

     

     

     

    ApplyButtonText="Filter Inventory" OnFieldEditorCreating="RadFilter_FieldEditorCreating" OnItemCommand="InventoriesRadFilter_ItemCommand">

     

     

     

    <FieldEditors>

     

     

     

    <goldcustom:RadFilterComboBoxEditor DataSourceID="GetCustInvODS" FieldName="OWNER_COMPANYNAME" DisplayName="Owner Name" ComboBoxSkin="WebBlue" ComboBoxWidth="350px"

     

     

     

    DataType="System.String" />

     

     

     

    </FieldEditors>

     

     

     

    </telerik:RadFilter>

     

    THE ODS [need somehow to get what's typed in the RadFilterComboBoxEditor above

     

     

    public DataTable getCustForInventory()

     

    {

     

     

    DataTable dt = new DataTable();

     

     

     

    int[] myLoc = DivisionIDArray;

     

     

     

    using (InventoryBC ibc = new InventoryBC())

     

    {

    dt = ibc.GetCustomerForInventory(myLoc,

     

    "" );

     

     

     

    return dt;

     

    }

    }




    THE CLASS:

     

     

    public override void InitializeEditor(Control container)

     

    {

    comboBox =

     

    new RadComboBox();

     

    comboBox.ID =

     

    "ComboBoxEditor" + FieldName;

     

    comboBox.DataSourceID = DataSourceID;

    comboBox.OnClientSelectedIndexChanged =

     

    "clientSelectedIndexChanged";//changes focus to the default button of the page

     

    comboBox.OnClientLoad =

     

    "clientSelectedIndexChanged";//changes focus to the default button of the page so, 1st item in the list can be selected

     

    comboBox.DataTextField = (

     

    String.IsNullOrEmpty(DataTextField)) ? FieldName : DataTextField;

     

    comboBox.DataValueField = (

     

    String.IsNullOrEmpty(DataValueField)) ? FieldName : DataValueField;

     

    comboBox.Skin = ComboBoxSkin;

    comboBox.Width = ComboBoxWidth;

    container.Controls.Add(comboBox);

    }

  2. Antonio Stoilkov
    Admin
    Antonio Stoilkov avatar
    530 posts

    Posted 27 Jun 2013 Link to this post

    Hi Rik,

    In order to achieve your scenario you could set the RadComboBox.AllowCustomText property to true which enables the typing functionality in the RadComboBox input.

    Regards,
    Antonio Stoilkov
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. rik butcher
    rik butcher avatar
    106 posts
    Member since:
    Jul 2009

    Posted 27 Jun 2013 Link to this post

    i'm glad you mentioned that. i had actually tried that & yes it allowed typing - but the typing went nowhere. when clicking the apply button - the RadFilter was blank. i've noticed a couple of things about controls in RadFilters. they seem to lose a lot of properties that they would have if otherwise put on a page as a stand-alone control. comboboxes can only hold one value. not like a stand alone that has [DataValueField & DataTextField] - if this is not true and it does indeed hold the two values - i need some help accomplishing this. the other thing is of course the "OnItemsRequested" feature than can fire an event. if i'm wrong on this can you please help me figure this out.
    thanks again for all your support
    rik
  5. rik butcher
    rik butcher avatar
    106 posts
    Member since:
    Jul 2009

    Posted 27 Jun 2013 Link to this post

    i guess i should have provided an example: the FilterExpression takes the Field Name - not the DataValueField 

     

     

    <goldcustom:RadFilterComboBoxEditor DataSourceID="GetCustInvODS" FieldName="OWNER_COMPANYNAME" DisplayName="Owner Name(List)" ComboBoxSkin="WebBlue" ComboBoxWidth="350px"

     

     

     

    DataType="System.String" />

     

  6. Antonio Stoilkov
    Admin
    Antonio Stoilkov avatar
    530 posts

    Posted 02 Jul 2013 Link to this post

    Hello Rik,

    I am not sure I understand you completely. If your scenario is to enable RadComboBox LoadOnDemand and by typing in the RadComboBox you want to filter the results and then choose the best result you could follow the demo below which showcases the same exact scenario. Note that you will need to move the aspx declaration to server programmatic creation.

    What do you mean by RadComboBox holding only one value? In the provided code you have set both DataTextField and DataValueField and the values will be transferred on the client correctly.

    Regards,
    Antonio Stoilkov
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  7. rik butcher
    rik butcher avatar
    106 posts
    Member since:
    Jul 2009

    Posted 02 Jul 2013 Link to this post

    i can enable loadOnDemand when the editor is initialized - but there's no public property
    for:  EnableLoadOnDemand="True"  OR OnItemsRequested="RadComboBox2_ItemsRequested"

    i guess that's where i'm stuck

     

     

    public override void InitializeEditor(Control container)

     

    {

    comboBox =

     

    new RadComboBox();

     

    comboBox.ID =

     

    "ComboBoxEditor" + FieldName;

     

    comboBox.DataSourceID = DataSourceID;

    comboBox.OnClientSelectedIndexChanged =

     

    "clientSelectedIndexChanged";//changes focus to the default button of the page

     

    comboBox.OnClientLoad =

     

    "clientSelectedIndexChanged";//changes focus to the default button of the page so, 1st item in the list can be selected

     

    comboBox.DataTextField = (

     

    String.IsNullOrEmpty(DataTextField)) ? FieldName : DataTextField;

     

    comboBox.DataValueField = (

     

    String.IsNullOrEmpty(DataValueField)) ? FieldName : DataValueField;

     

    comboBox.Skin = ComboBoxSkin;

    comboBox.Width = ComboBoxWidth;

    comboBox.EnableLoadOnDemand =

     

    true;

     

    comboBox.AllowCustomText =

     

    true;

     

    container.Controls.Add(comboBox);

    }

  8. Antonio Stoilkov
    Admin
    Antonio Stoilkov avatar
    530 posts

    Posted 05 Jul 2013 Link to this post

    Hi Rik,

    I am not sure I understand you correctly. In the provided code you have set the EnableLoadOnDemand property to true. If your issue is that you don't have the EnableLoadOnDemand as public property for the editor you could create it as shown below. Note that the same approach could also be used for the OnItemsRequested event.
    public bool EnableLoadOnDemand
    {
        get
        {
            return comboBox.EnableLoadOnDemand;
        }
        set
        {
            comboBox.EnableLoadOnDemand = value;
        }
    }

    Additionally, in order to fully understand the problem and provide you with a solution you could upload a sample running project on a public sharing site and provide us with a link so we could download it, debug it and advice you with the best possible solution.

    Regards,
    Antonio Stoilkov
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017