This is a migrated thread and some comments may be shown as answers.

typeable ComboBox in radFilter

6 Answers 91 Views
Filter
This is a migrated thread and some comments may be shown as answers.
rik butcher
Top achievements
Rank 1
rik butcher asked on 24 Jun 2013, 05:33 PM
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);

}

6 Answers, 1 is accepted

Sort by
0
Antonio Stoilkov
Telerik team
answered on 27 Jun 2013, 07:35 AM
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.
0
rik butcher
Top achievements
Rank 1
answered on 27 Jun 2013, 11:14 AM
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
0
rik butcher
Top achievements
Rank 1
answered on 27 Jun 2013, 11:28 AM
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" />

 

0
Antonio Stoilkov
Telerik team
answered on 02 Jul 2013, 06:19 AM
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.
0
rik butcher
Top achievements
Rank 1
answered on 02 Jul 2013, 12:01 PM
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);

}

0
Antonio Stoilkov
Telerik team
answered on 05 Jul 2013, 06:02 AM
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.
Tags
Filter
Asked by
rik butcher
Top achievements
Rank 1
Answers by
Antonio Stoilkov
Telerik team
rik butcher
Top achievements
Rank 1
Share this question
or