HI
Moving from VB to C# (still learning). I have installed Ajax control toolkit and tested it with an accordion. Thus I know the tool kit is installed correctly.
Have added a Webservice.asmx file and added reference to the service. Added a button and text box and with code behind can reach the webservice method which returns a value (just test junk for the moment)
page markup for test button
<div>
<asp:Button ID="Button1" runat="server"
Text="Button"
OnClick="Button1_Click"
style="height: 26px" />
<br />
<asp:Label ID="Label1" runat="server"
Text="Label">
</asp:Label>
</div>
code behind for button
protected void Button1_Click(object sender, EventArgs e)
{
WebService webService = new WebService();
List<int> lstIntegers = new List<int> { 5, 6, 7 };
Label1.Text = "Output of WebService: " + webService.Add(lstIntegers).ToString();
}
and finally web method which works.
[WebMethod]
public int Add(List<int> listInt)
{
//https://www.c-sharpcorner.com/article/how-to-create-a-web-service-project-in-net-using-visual-studio/
int result = 0;
for (int i = 0; i < listInt.Count; i++)
{
result = result + listInt[i];
}
return result;
}
I run into troubles when I add a text box and and associated autocompleteextender. (this works ok when I program using VB)
page markup for text box and autocompleteextender
<asp:TextBox ID="ImageNameSearchTextBox" runat="server"
style="width:100%">
</asp:TextBox>
<ajaxToolkit:AutoCompleteExtender ID="ImageNameSearchTextBox_AutoCompleteExtender" runat="server"
BehaviorID="ImageNameSearchTextBox_AutoCompleteExtender"
DelimiterCharacters=""
ServicePath="~/WebService.asmx"
ServiceMethod="Get_Image_Names"
CompletionInterval="10"
completionsetcount="10"
enablecaching="true"
MinimumPrefixLength="1"
TargetControlID="ImageNameSearchTextBox">
</ajaxToolkit:AutoCompleteExtender>
and associated web method. which should return a list of letters.
public List<string> Get_Image_Names(string prefixText, int count)
{
//https://www.aspdotnet-suresh.com/2011/03/how-to-implement-auto-complete-textbox.html
List<string> my_list = new List<string>();
my_list.Add("ab");
my_list.Add("ak");
my_list.Add("kl");
my_list.Add("kk");
return my_list;
}
What am I missing?
Thanks in advance for any help!