Passing multiple values through asp web service

4 posts, 0 answers
  1. Chad
    Chad avatar
    10 posts
    Member since:
    Feb 2013

    Posted 29 Oct 2013 Link to this post

    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


  2. Marin
    Admin
    Marin avatar
    1045 posts

    Posted 01 Nov 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Chad
    Chad avatar
    10 posts
    Member since:
    Feb 2013

    Posted 06 Nov 2013 Link to this post

    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.
  5. Marin
    Admin
    Marin avatar
    1045 posts

    Posted 11 Nov 2013 Link to this post

    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.
Back to Top