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.
Unfortunately, activation email could not send to your email. Please try again.

AutoComplete and MatchMode = Manual

Thread ID:

Created:

Updated:

Platform:

Replies:

52512 Nov 29,2006 01:35 PM Dec 1,2006 09:45 AM Windows Forms 5
loading
Tags: Tools
Mark Atkinson
Asked On November 29, 2006 01:35 PM

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);

Anupama Roy [Syncfusion]
Replied On November 30, 2006 09:43 AM

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.

Anupama Roy [Syncfusion]
Replied On November 30, 2006 10:42 AM

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.

Administrator [Syncfusion]
Replied On November 30, 2006 08:57 PM

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.

Anupama Roy [Syncfusion]
Replied On December 1, 2006 09:41 AM

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


Anupama Roy [Syncfusion]
Replied On December 1, 2006 09:45 AM

Hi Mark,

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

Link


Regards,

Anu.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;