admin管理员组

文章数量:1417070

Refer the Image, having 2 TextBox(tbxAttribute and tbxAttributeDesc). Value will be loaded when page is loaded in tbxAttribute TextBox.In tbxAttributeDesc TextBox the end user will Fill that Data.

I have already Completed the Autoplete Text in tbxAttributeDesc. We are maintaining these Values in a table, Based up on the loaded tbxAttribute value their corresponding AttributeDesc will be highlight into tbxAttributeDesc Textbox

My Code be:

autoDesc = new AjaxControlToolkit.AutoCompleteExtender();

autoDesc.ID = "autoDesc" + i; 

autoDesc.BehaviorID = "tbxAtribute" + i;

autoDesc.ServicePath = "itemvaluemas.asmx";

autoDesc.ServiceMethod = "GetAttributeDesc";

autoDesc.TargetControlID = tbxAttributeDesc.ID;

autoDesc.MinimumPrefixLength = 1;

autoDesc.CompletionInterval = 10; 

autoDesc.FirstRowSelected = true;

autoDesc.CompletionSetCount = 30;

autoDesc.UseContextKey = true;

and also used Javscript Concept.

Refer the Below Image:

Here i need to pass condition as tbxAtribute and their Corresponding tbxAtributeDesc, based up on that tbxAbbr Value need to be highlight..

if i use ContextKey then how i pass these two textbox value in a context key..

If you have any idea please help to solve this problem.

Refer the Image, having 2 TextBox(tbxAttribute and tbxAttributeDesc). Value will be loaded when page is loaded in tbxAttribute TextBox.In tbxAttributeDesc TextBox the end user will Fill that Data.

I have already Completed the Autoplete Text in tbxAttributeDesc. We are maintaining these Values in a table, Based up on the loaded tbxAttribute value their corresponding AttributeDesc will be highlight into tbxAttributeDesc Textbox

My Code be:

autoDesc = new AjaxControlToolkit.AutoCompleteExtender();

autoDesc.ID = "autoDesc" + i; 

autoDesc.BehaviorID = "tbxAtribute" + i;

autoDesc.ServicePath = "itemvaluemas.asmx";

autoDesc.ServiceMethod = "GetAttributeDesc";

autoDesc.TargetControlID = tbxAttributeDesc.ID;

autoDesc.MinimumPrefixLength = 1;

autoDesc.CompletionInterval = 10; 

autoDesc.FirstRowSelected = true;

autoDesc.CompletionSetCount = 30;

autoDesc.UseContextKey = true;

and also used Javscript Concept.

Refer the Below Image:

Here i need to pass condition as tbxAtribute and their Corresponding tbxAtributeDesc, based up on that tbxAbbr Value need to be highlight..

if i use ContextKey then how i pass these two textbox value in a context key..

If you have any idea please help to solve this problem.

Share Improve this question edited Jun 14, 2012 at 7:00 munity wiki
15 revs, 2 users 97%
Prince Antony G 5
  • 1 i think it's hard to understand what do you mean, can you explain with some code examples? – hackp0int Commented Jun 11, 2012 at 10:47
  • if we search in Google Seach- if we enter 'A' then the google engine shows the list of options starts letter 'A'.. As the same concept i need to implement in my textbox.. But here based up on the tbxAttribute textbox the coresponding attributedesc will be shown.. – Prince Antony G Commented Jun 11, 2012 at 10:55
  • i think you need, to implement javascript observer, that will watch over the two textboxes and will handle the text change interaction. – hackp0int Commented Jun 11, 2012 at 11:07
  • @PrinceAntonyG please show the code you currently use to retreive the list of autplete values. The most probable solution is that you alter the method that provides these values, so that it can accept an Attribute string, based upon which it returns the possible values. So instead of GetAutoCompleteValues(AttributeDescriptionTextBox.Text), call GetAutoCompleteValues(AttributeTextBox.Text, AttributeDescriptionTextBox.Text). – CodeCaster Commented Jun 11, 2012 at 11:32
  • Refer my solution below,if any one have better solution than this..Please post ur answer – Prince Antony G Commented Jun 22, 2012 at 8:42
Add a ment  | 

2 Answers 2

Reset to default 3 +100

Use ContextKey property to pass the value of textbox into GetAutoCompleteValues function.

txtbox1.Attributes.Add("onchange", "$find('BehaviourIDOftbxAttributeDesc').set_contextKey(tbxAttribute.value);");

For more information check the below links:

AJAX C# AutoCompleteExtender contextKey

http://arrao4u.wordpress./2010/01/14/autoplete-extender-with-context-key/

This is the Solution which i found.

I use JavaScript:

function SetContextAbbr(formatid, itemValue, behaveid) {
var autoComplete1 = $find(behaveid);
var target = autoComplete1.get_element();
var txtformatid = document.getElementById(formatid);
var txtitemValue = document.getElementById(itemValue);
var contextkeydata = txtformatid.value + "-" + txtitemValue.value;
autoComplete1.set_contextKey(contextkeydata);
}

Use Function as

 public string[] GetItemabbr(string prefixText, int count, string contextKey)
 {
        string[] splitvalue = contextKey.Split('-');

        //code here
 }

In WebService

                    autoabbr = new AjaxControlToolkit.AutoCompleteExtender();
                    autoabbr.ID = "autoabbr" + i;
                    autoabbr.BehaviorID = "autoabbrbehave" + i;
                    autoabbr.ServicePath ="itemvaluemas.asmx";
                    autoabbr.ServiceMethod = "GetItemabbr";
                    autoabbr.TargetControlID = txtItemAbbrValue.ID;
                    autoabbr.MinimumPrefixLength = 1;
                    autoabbr.CompletionInterval = 10;
                    autoabbr.FirstRowSelected = true;
                    autoabbr.CompletionListCssClass = "pletionList";
                    autoabbr.CompletionListHighlightedItemCssClass = "itemHighlighted";
                    autoabbr.CompletionListItemCssClass = "listItem";
                    autoabbr.CompletionSetCount = 30;
                    autoabbr.UseContextKey = true;

本文标签: cAutoComplete with context key in a Textbox based on two parametersStack Overflow