Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello,
I have created Autocomplete text box which shows EmployeeIds of perticular department.

However I am giving option user to select Department from DropDown. i want to pass this selected value to web service that has code for autocomplete.
Following is code in my aspx page:

<asp:TextBox ID="tbEmployeeID" runat="server" CssClass="textBox"></asp:TextBox>
<act:AutoCompleteExtender ID="tbEmployeeID_AutoCompleteExtender"  runat="server" ServicePath="~/EmployeeIDs.asmx" ServiceMethod="GetCompletionList" TargetControlID="tbEmployeeID" MinimumPrefixLength="1"  CompletionInterval="100" CompletionSetCount="10" ShowOnlyCurrentWordInCompletionListItem="true">
</act:AutoCompleteExtender>


How can I pass parameter to webservice?

I even tried using Sessions from codebehind file.. but I got error I webservice saying "Object reference not set to an instance of an object.".

How can I do this..
Please help me

Thank you
Posted

 
Share this answer
 
Comments
tejashri.gandhi 13-Jan-12 7:38am    
Thank you for sharing these links..
M.Sravan Kumar 26-May-12 6:23am    
hi,
how to pass parameters in webservices like categoryname and productname?
You may use the ContextKey as UseContextKey="True" ContextKey="<your department>"

VB
Public Function GetCompletionList(ByVal prefixText As String, ByVal count As Integer, ByVal contextKey As String) As String()
'Use contextKey in your query
 
Share this answer
 
v3
Comments
tejashri.gandhi 13-Jan-12 0:55am    
I did this.., however it is passing null value even though dropdown value is selected.

<pre>
<asp:TextBox ID="tbEmployeeID" runat="server" CssClass="textBox">
<act:AutoCompleteExtender ID="tbEmployeeID_AutoCompleteExtender" runat="server" ServicePath="~/EmployeeIDs.asmx" ServiceMethod="GetCompletionList" TargetControlID="tbEmployeeID" MinimumPrefixLength="1" UseContextKey="true" ContextKey="<%# Eval(ddlCostCentre.SelectedValue) %>" CompletionInterval="100" CompletionSetCount="10" ShowOnlyCurrentWordInCompletionListItem="true"></pre>
Prerak Patel 13-Jan-12 3:28am    
You can set context key on change of dropdown, on server/by javascript.
Link 1, Link 2
tejashri.gandhi 13-Jan-12 3:55am    
Thanks..its working fine now..
Prerak Patel 13-Jan-12 4:07am    
You are welcome.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900