WCF / ASMX :: AutoComplete Extender Not Calling Web Service
Mar 24, 2011
I am using AutoComplete ASP.NET AJAX Control toolkit AutoCompleteExtender control When I am using my web service as Service Path, its not working.my web services code below
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Data.SqlClient;
using System.Data;
using System.Web.Script.Services;
namespace OnlineSalesGrid
{
/// <summary>
/// Summary description for sample
/// </summary>
[WebService(Namespace = [URL]]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class sample : System.Web.Services.WebService
{
[WebMethod]
public static string[] GetCompletionList(string prefixText, int count)
{
List<string> returnData = new List<string>();
SqlConnection con = new SqlConnection("Data Source=CARPATHIA\SQLEXPRESS;Initial Catalog=OnlinesaleGrid;Persist Security Info=True;User ID=sa;Password=c0rpusdata");
string sql = "select Customer_Name from Customer_Master where Customer_Name like '%" + prefixText + "%'";
SqlCommand cmd = new SqlCommand(sql, con);
con.Open();
SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
while (reader.Read()) { returnData.Add(reader["Customer_Name"].ToString()); }
return returnData.ToArray();
}
[WebMethod]
public static string[] GetCompletionList1(string prefixText, int count)
{
List<string> returnData = new List<string>();
SqlConnection con = new SqlConnection("Data Source=CARPATHIA\SQLEXPRESS;Initial Catalog=OnlinesaleGrid;Persist Security Info=True;User ID=sa;Password=c0rpusdata");
string sql = "select Customer_Code,Customer_Name from Customer_Master where Customer_Code like '%" + prefixText + "%'";
SqlCommand cmd = new SqlCommand(sql, con);
con.Open();
SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
while (reader.Read())
{
returnData.Add(reader["Customer_Code"].ToString());
}
return returnData.ToArray();
}
}
}
Html Code is
<asp:ScriptManager ID="toolscpt1" runat="server" >
<Services>
<asp:ServiceReference Path="~/sample.asmx" />
</Services>
</asp:ScriptManager>
<asp:TextBox
ID="txtcname" runat="server" CssClass="textbox" onBlur='funblurcolor(this.id)' onFocus='funfocuscolor(this.id)'
ontextchanged="txtcname_TextChanged1" onkeypress="javascript:if(window.event.keyCode == 13) document.getElementById('txtphno').focus" ></asp:TextBox>
<asp:AutoCompleteExtender ID="txtname_AutoCompleteExtender"
runat="server" Enabled="True" ServiceMethod ="GetCompletionList" ServicePath="~/sample.asmx"
MinimumPrefixLength="1" CompletionSetCount ="12" EnableCaching ="true" CompletionInterval ="500"
TargetControlID="txtcname" ></asp:AutoCompleteExtender>
View 14 Replies
Similar Messages:
Feb 22, 2011
web service method(getMainHeads) with parameter is not calling with auto complete text box extender(same method with out parameter is calling fine). My Service is
[System.Web.Script.Services.
ScriptService]
public
class
InvService : System.Web.Services.WebService
{
ItemMainHeadMsts objItemMainHeadMsts;
DatabaseHelper objDataHelper;
[WebMethod]
public
string[] GetMainHeads(string value)
{
List<string>
oList = new
List<string
>();
objItemMainHeadMsts =
new
ItemMainHeadMsts
();
objDataHelper =
new
DatabaseHelper
();
objItemMainHeadMsts =
ItemMainHeadMstBase.SelectByFieldAuto("IMHDesc"
, value);
foreach (ItemMainHeadMst
mainHead in
objItemMainHeadMsts)
{
oList.Add(mainHead.IMHDesc);
}
return
oList.ToArray();..........................
View 4 Replies
Apr 8, 2010
VS2008
Using C#
AJAX Toolkit 20229.20185
I have an AJAX auto complete extender that calls a web service to generate a string[] for a textbox. Works great, The issue I am having is that I set the OnClientItemSelected property of the auto complete extender to call a JavaScript function that will intern call another web service to get the remaining data I need based on the item that was selected. (I need this because the auto complete web service only allows for key/value pairs and I need to return 10 columns of data) I cannot get the JS function to call the web service. I keep getting "(Namespace) is undefined" as a JS error. I tried to impliment Microsoft's example located at: [URL] but even if I copy there code line for line in a new project, I still encounter the same error.
Samples.AspNet.WebService.Add(a, b,SucceededCallback); //'Samples' is undefined - runtime If I remove the namespace so that it reads: Add(a, b,SucceededCallback); //Endless loop until you get stack overflow error
Has anyone got MS C# example to work? I saw a lot of people had this line missing in the web service, but I already had it. [System.Web.Script.Services.ScriptService]
View 2 Replies
Jul 26, 2010
I am not sure about writing the method in the web service. I'm trying to select the client names from sql server, then storing them into an arraylist. Finally, returning the array of names. This is my code:
[Code]....
My method has an error.
View 9 Replies
Dec 19, 2010
there ( my first post in this forum ). i created a web service which searches for user info from a adatabase
based on the user id(input). i want to call this service from the bookstore web site i created for my course project but apparently i'm not doing something right. i get an error : [IndexOutOfRangeException: Index was outside the bounds of the array]. So to give you an idea of exactly what i've done so far, here's the code...
First for the web sevice: using System;
View 4 Replies
Jul 8, 2010
how can i call mtom web service without param for the attachment from web service built in java
View 3 Replies
Jun 20, 2010
[Code]....
Should I change the configuration so the service could be called from other domain?
View 4 Replies
Jul 20, 2010
[Code].... Should I change the configuration so the service could be called from other domain?
View 5 Replies
Aug 27, 2010
How can i check that which Endpoint is calling WCF Service.
View 1 Replies
Jun 15, 2010
I am trying to call an asmx service using the jQuery ajax call-
[Code]....
I have double checked the url of the service and spelling/case of the name of the method as well as the parameters in the dataStr.
I still get the error-<b> Description: </b>HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. review the following URL and make sure that it is spelled correctly.
in the responseText of XMLHttpRequest, above.
View 3 Replies
Mar 31, 2011
I have a website(X) hosted on a Windows server .
This Website is running under a AppPool= "CustomAppPool" ( Im using a specific AD Username and Password as the credentials for the apppool)
Website Is running under Credentials "DomainNameUsrName"
This Website should access a WCF service which is running under "MAchineNameASPNET" process
When i try to get the details of the calling method (UsrName) from the client calling the WCF ..... Im unable to to do so
I am always gettting the MachineNameASPNET as the credentials
How can i get the "DomainNameUsrName" from the callign website
View 1 Replies
Dec 30, 2010
I have wcf web service, I works fine on my local machine,but when I move it to live then it throws following error
System.Security.SecurityException: Request for the permission of type 'System.Configuration.ConfigurationPermission, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' failed.
View 2 Replies
Sep 15, 2010
I have a web service that has a CreateReport method that generates a report based on the specified criteria.
When I call this method Synchronously using a Windows Application or Console Application, the call works fine and the report is created.
When I call this method ASynchronously (CreateReportASync) using Windows Application the report is created.
When I call this method ASynchronously (CreateReportASync) using Console Application the web service does not even get the call.
I am using VS2005 and .Net Framework 2.0. So the proxy is automatically created with the Async methods. I am not really interested the result of the method call, so I do not add a Callback Delegate.
View 4 Replies
Mar 16, 2011
how to create a Web service that returns a JSON(or JSONP). That also should be able to work for cross-domain access aswell as for a local call.. help to get this working or for a few links for further reading about this
View 2 Replies
Sep 29, 2010
I'm creating just simple autocomplete sample.
taking one textbox adding autocomplete extender as
<asp:ScriptManager ID="ScriptManager2" runat="server">
<Services>
<asp:ServiceReference Path="WebService.asmx" />
</Services>
</asp:ScriptManager>
<asp:TextBox ID="TextBox1" runat="server" EnableTheming="True" ></asp:TextBox>
<cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" MinimumPrefixLength="1" ServiceMethod="GetCountryInfo" ServicePath="WebService.asmx" TargetControlID="TextBox1">
</cc1:AutoCompleteExtender>
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
Also creating web services as "WebService.asmx" & code inside this file is that
<%@ WebService Language="C#" CodeBehind="~/App_Code/WebService.cs" %>
------
then in Webservice.cs file i write code as
public class WebService : System.Web.Services.WebService {
MySql.Data.MySqlClient.MySqlCommand cmd = new MySqlCommand();
MySql.Data.MySqlClient.MySqlConnection con = new MySqlConnection();
//MySqlDataAdapter da = new MySqlDataAdapter();
MySqlDataReader dr;
public WebService () {
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public string[] GetCountryInfo(string prefixText)
{
int count = 10;
string sql = "Select * from tbl_patientmaster Where P_NAME like '" + @prefixText + "%'";
con.ConnectionString = System.Configuration.ConfigurationManager.AppSettings["HMSDBConnectionString"].ToString();
con.Open();
MySql.Data.MySqlClient.MySqlDataAdapter da = new MySql.Data.MySqlClient.MySqlDataAdapter(sql, con);
da.SelectCommand.Parameters.Add("@prefixText", MySql.Data.MySqlClient.MySqlDbType.VarChar, 50).Value = prefixText + "%";
System.Data.DataTable dt = new System.Data.DataTable();
da.Fill(dt);
string[] items = new string[dt.Rows.Count];
int i = 0;
foreach (System.Data.DataRow dr in dt.Rows)
{
items.SetValue(dr["P_NAME"].ToString(), i);
i++;
}
return items;
}
this code is not working
View 1 Replies
Aug 30, 2010
I am maintaining a web site project in VS2005 and have to call a new web service on a remote server. I've done add web reference, and created the .wsdl and .discomap files in the app_webReference folder. When I try to create a object representing the web service in the code ( wsnamespace.serviceName ws = new wsnamespce.serviceName(); ) the code wouldn't compile.
The web site project is already calling other web services. When I right click on the type representing the web service and "go to definition" it takes me to a proxy class (derived from of course SoapHttpClientProtocol) in the metadata. I think this is what's missing for the new web service i'm trying to call. Have I missed any steps?
View 1 Replies
Dec 20, 2010
These types of exceptions always irritate me because they are almost impossible to reproduce consistently and have almost no documentation other than the cryptic error itself to have any idea on how to fix the problem. So I have a Windows Service that makes a call to a .asmx web service over https on a polled interval every 20 minutes. Once in a great while the following exception message is returned:
Message: The underlying connection was closed: An unexpected error occurred on a receive.
Inner Message: System.IO.IOException: The decryption operation failed, see inner exception. ---> System.ComponentModel.Win32Exception:
The specified data could not be decrypted --- End of inner exception stack trace --- at
System.Net.Security._SslStream.ProcessReadErrorCode(SecurityStatus
errorCode, Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest, Byte[] extraBuffer) at System.Net.Security._SslStream.ProcessFrameBody(Int32 readBytes, Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest) at
System.Net.Security._SslStream.StartFrameBody(Int32 readBytes, Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.Security._SslStream.StartFrameHeader(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security._SslStream.StartReading(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.Security._SslStream.ProcessRead(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.TlsStream.Read(Byte[]
buffer, Int32 offset, Int32 size) at System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size) at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead)
So from reading the above message there was an error on receive and the data could not be decrypted. The does not occur consistently, so I don't have a good way of reproducing it. I also lack at low level messaging knowledge and I feel that this is the answer behind this exception; i.e. dropped packets and an incomplete message not appearing to be the same message as sent from the service or something. Any .asmx gurus out there that can give insight and possibly prevention suggestions for the above issue?
View 2 Replies
Jan 14, 2011
how to use autocomplete extender in asp.net
View 1 Replies
Jun 7, 2010
I am using AJAX Control toolkit V-1.0.
I am coming across one problem with auto complete extender in my application, problem seems to simple but i can't find any satisfactory solution. In one form, i have set auto complete extender on one text box, i have set one web service, in which one function is there, which fetches existing records from db, on first load, if i write releavent words with that of db, i can't see the extender, but if once either i minimize the page or give tab despite AutoPostBack property of text box is false, then after writing something in text box shows me the extender.
Here are the properties of both text box and extender
<asp:TextBox
ID="txtCompanyName"
runat="server"
CssClass="txt"
MaxLength="100"
TabIndex="4"
Width="443px"
></asp:TextBox>.........
View 1 Replies
Aug 22, 2010
I have a ajax autocomplete extender and everything works fine. I mean sql procedure and others are fine but when I enter something to textbox nothing happened. Why is that?
Here is my codes.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
[Code]....
View 1 Replies
Dec 8, 2010
I went through lots of forums, posts etc. But never found really good answer on this.I'm trying to add AutoComplete Extender to TextBox and display some tips to users.Everything is fine when this code is placed in Content Page. But I've got like ~10 Content Pages based on one Master Page so it's completely stupid to repeat the code on each one.
There are some answers on the web but they are only partial ones, check if you wan't:
Could post only one link :/
Here is my code:
Master Page:
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Services>
<asp:ServiceReference Path="~/AutoComplete.asmx" />
</Services>
</asp:ScriptManager>
[Code]....
View 1 Replies
Aug 22, 2010
I have a ajax autocomplete extender and when I enter something to textbox nothing happened. Why is that?
Here is my codes.
[Code]....
HTML Side:
[Code]....
View 11 Replies
May 12, 2010
Iam getting an array of list from database to client side(javascript array).Now my aim to place those values in a div one by one and that div should attach to the textbox similar to Autocomplete extender.
View 4 Replies
Feb 11, 2011
Textbox is now woking as per the requirment:
HTML:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AutoComplete.aspx.cs" Inherits="AutoComplete" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
[Code]....
When I browse the web service in the browser, it is working fine but not working on aspx
View 1 Replies
Dec 20, 2010
how to implement autocomplete extender? i want to take datas from a particular table and store in autocomplete textbox.
View 5 Replies