This is a migrated thread and some comments may be shown as answers.

Passing multiple values through asp web service

3 Answers 161 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Chad
Top achievements
Rank 1
Chad asked on 29 Oct 2013, 04:38 PM
I was curious if there is a way to pass 3 values through an asp web service.  I have the control working well with two values but I would like to add an additional value to pass.  Everytime I try I get an error.

Here is my code.
     <script type="text/javascript">
         function SelectedName(source, eventArgs) {
             var txt = eventArgs.get_text();
             var val = eventArgs.get_value();
             var radWidow = $find("<%= radDashboard.ClientID%>");
             var textbox = document.getElementById("<%=txtSearch.ClientID%>");
 
                      if (val == '') {
                          alert('You must pick a recruit from drop down list.');
                      }
                      else {
                          radWidow.show();
                          radWidow.maximize();
                          radWidow.setUrl("ManageProcessor.aspx?Pass=" + val);
 
                          textbox.value = '';
                      }
                  }
 
       </script>
        <link href="../Recuiting.css" rel="stylesheet" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="BodyContent" Runat="Server">
    <telerik:RadAjaxPanel ID="radajax" runat="server">
        <div style="width:auto">
            <div class="dvGridWrapper">
                    <asp:HiddenField ID="HFRecruit" runat="server" />
                    <asp:TextBox ID="txtSearch" runat="server" Width="260px" ToolTip="Enter Last Name First Name"></asp:TextBox>
                    <asp:TextBoxWatermarkExtender ID="txtSearch_WME" runat="server" TargetControlID="txtSearch" WatermarkText="Lookup Processor" WatermarkCssClass="Watermark"></asp:TextBoxWatermarkExtender>
                    <asp:AutoCompleteExtender ID="txtSearchr_ACE" runat="server" TargetControlID="txtSearch" DelimiterCharacters="" Enabled="True" ServiceMethod="FindRecName" ServicePath="~/Recruiting.asmx" UseContextkey="true" 
                          MinimumPrefixLength="2" OnClientItemSelected="SelectedName" EnableCaching="true" CompletionInterval="1"></asp:AutoCompleteExtender>

Code Behind
    <WebMethod()> _
    Public Function FindRecName(ByVal prefixText As StringByVal count As StringAs String()
        Dim items As New List(Of String)
 
 
        sql = "select intRecruitID, intEnlistmentTypeID, strlastname + ' ' + strFirstname + ' ' + strMiddleName + ' (' + SUBSTRING(strssn, 6, 9) + ')' Name from Recruit where strLastName like '" & prefixText & "%' ORDER BY Name ASC"
 
        myDataTable = New DataTable
        myDataTable = getData(sql)
 
        If myDataTable.Rows.Count > 0 Then
            For Each dRow As DataRow In myDataTable.Rows
                items.Add(AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(dRow("Name"), dRow("intRecruitID")))
 
            Next
 
        End If
 
        Return items.ToArray
    End Function


3 Answers, 1 is accepted

Sort by
0
Marin
Telerik team
answered on 01 Nov 2013, 09:49 AM
Hello,

 Generally calling a web service method should not be limited by the number of its parameters. It depends where exactly in the code you call the web service, whether you properly pass all arguments and at what point in the code exception originated exactly and whether it provided more details to the nature of the error.

Also is this problem related in any way to the use of Telerik controls on the page?

Regards,
Marin
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Chad
Top achievements
Rank 1
answered on 06 Nov 2013, 04:49 PM
Not originally a telerik related problem, but I am planning to use a tellerik auto complete box and was curious if you can pass more than just the text and id values.  I would like to pass 1 text and 2 id values through the service.
0
Marin
Telerik team
answered on 11 Nov 2013, 04:21 PM
Hello,

 This should be possible, as I mentioned in my previous post the web services are normally not limited to passing a certain number of parameters. This depend on the overall specific of the kind of web service you are using, how you have designed its contract, the way of calling the service methods in the code and so on. The exception that you are receiving and its stack trace should provide information on exactly what went wrong with the request when there are more parameters.

Regards,
Marin
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
AutoCompleteBox
Asked by
Chad
Top achievements
Rank 1
Answers by
Marin
Telerik team
Chad
Top achievements
Rank 1
Share this question
or