We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

AutoComplete and MatchMode = Manual

When I use an AutoComplete component with a TextBox and override the MatchItem event handler (I want to use a "contains" match rather than "starts with"), I'm unable to match with the desired column. In the code sample below, I'm hoping to match on the "Desc" column rather than the "Code" column in the underlying data source but it always seems to find matches in the "Code" column.
In my overridden MatchItem event handler, the PossibleMatch property of the AutoCompleteMatchItemEventArgs is always a value from the "Code" column. The "Code" column happens to be the first column in the underlying data source.
Any ideas?


AutoCompleteDataColumnInfo info = new AutoCompleteDataColumnInfo ("Desc", 100, true);
info.MatchingColumn = true;
autoComplete.Columns.Add (info);

AutoCompleteDataColumnInfo info2 = new AutoCompleteDataColumnInfo ("Code", 100, true);
autoComplete.Columns.Add (info2);

5 Replies

AR Anupama Roy Syncfusion Team November 30, 2006 02:43 PM UTC

Hi Mark,

I was able to reproduce the issue here and tried a workaround for this.However,that has not worked successfully.I am still looking into the source to find some other way to help you out.Meanwhile I will go ahead and log a bug report so that we can address this issue at the earliest.

Regards,

Anu.


AR Anupama Roy Syncfusion Team November 30, 2006 03:42 PM UTC

Hi Mark,

As the args.PossibleMatch is returning data from the first column itself,I tried getting the items of the other columns from the internal Table Data of AutoComplete and code for that is the below given one.By changing the index within ItemArray to the desired column index,you can get the items in that column.Could you please check out whether it helps you out in any ways?

foreach(DataRow itemRow in this.autoComplete1.TableData.Rows)

{
possibleMatch1= (string)itemRow.ItemArray[1];//Give desired column index instead of 1.


MessageBox.Show (possibleMatch1);


}

Regards,

Anu.


AD Administrator Syncfusion Team December 1, 2006 01:57 AM UTC

Hi Anu,
Thanks for the reply and info. The code you posted looks promising, but I can't think of how to make it work when the MatchItem event fires.

private void OnMatchItem (object sender, AutoCompleteMatchItemEventArgs args)
{
if (!EvaluateContains (args.PossibleMatch, args.CurrentText))
args.Cancel = true;
}

...if only the args parameter here had the ItemArray the way the ItemSelected does.

>Hi Mark,

As the args.PossibleMatch is returning data from the first column itself,I tried getting the items of the other columns from the internal Table Data of AutoComplete and code for that is the below given one.By changing the index within ItemArray to the desired column index,you can get the items in that column.Could you please check out whether it helps you out in any ways?

foreach(DataRow itemRow in this.autoComplete1.TableData.Rows)

{
possibleMatch1= (string)itemRow.ItemArray[1];//Give desired column index instead of 1.


MessageBox.Show (possibleMatch1);


}

Regards,

Anu.


AR Anupama Roy Syncfusion Team December 1, 2006 02:41 PM UTC

Hi Mark,

I am afraid,I could not make it work.I have logged a bug report in this regard and you can track the progress of bug fix through the below given link.

rel='nofollow' href="http://www.syncfusion.com/support/issues/tools/Default.aspx?ToDo=view&questId=3114">http://www.syncfusion.com/support/issues/tools/Default.aspx?ToDo=view&questId=3114

Best Regards,

Anu



AR Anupama Roy Syncfusion Team December 1, 2006 02:45 PM UTC

Hi Mark,

Sorry for the broken link.Including the correct one below.

Link


Regards,

Anu.

Loader.
Live Chat Icon For mobile
Up arrow icon