AJAX :: AutoCompleteExtender Not Calling WebMethod
Sep 10, 2010[Code]....
[Code]....
[Code]....
[Code]....
i have used AjaxToolkit:AutoCompleteExtender, which calls a web method to get string array. Everything was working fine as its populating all the data.But the issue arise when web method is returning value in a string array like
arr[0]=1-12-100
arr[1]=1-10-100
the value im getting in the AutoCompleteExtender is the subtract of the result like
arr[0]=-111
arr[1]=-109
Why is it treating it like numeric and doing calculation when the return type is actual an string. i think its has to do sth with serialize and deserialize thing
I tried your code for Autocomplete without Webservice and didn't work on my page. When I tried it on a new project it works fine but on my project it does not. I have other controls on the page but that shouldn't stop it from working right?
Attached is my code
<%@ Page Title="" Language="VB" MasterPageFile="~/intranet.master" AutoEventWireup="false" CodeFile="warehouse.aspx.vb" Inherits="warehouse" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
[CODE]...
I am developing a user control. This user control is having 2 Dropdown controls and one textbox('txtCustomer'). I am using autocompleteextender for the text box. This 'txtCustomer' control populates the data based on the value selected in 2 dropdowns.
I need to pass the selected value of this 2 dropdown to my meb method. I am not using web service(.asmx page) for this application instead i am using page level web method. I tried to access the controls from the web method inside the Page. but all the identifiers and controls of the page returning null in the web mothod. I have analysed it is because the events "page_Load and page_Init" are not getting fired.
I have some problem with the AutoCompleteExtender when it's include in an UpdatePanel.
Scenario:
I have create a UserControl with TextBox, AutoCompleteExtender and a "Save" LinkButton and I put this Control in the InsertItemTemplate of a ListView.
The AutoComplete uses a Method that I have created in a webservice.
All works fine untill i place my ListView in an UpdatePanel.
The webmethod don't fired. The strange thing is that if i put the same Control also out of my ListView it seems to work, but i can't catch the linkbutton click.
I am trying to implement your code in "Calling ASP.Net WebMethod using jQuery AJAX", but the alert is giving me the value "Undefined".
I believe my website (asp.net c#) is not correctely configured for webmethods.
my page Evaluation.aspx has this code
[Code]....
and I am calling the webmethod by javascript like this
[Code]....
The result is, I get the error function running and I get "undefined error" alert.Am I calling the procedure correctly? I put a breakpoint on the webmethod and it.
$.ajax(
{
type: "POST",
url: "Default.aspx/GetAge",
data: "{}",[code]...
Right now it reports the following error: "Cannot locate the resource". I figure that I am specifying the url incorrectly. This javascript is in an external file located in the same directory as Default.aspx .
I have register.aspx at root level folder and updateprofile.aspx in folder /secure/user/ .
pagemethods are working good at root level folder aspx pages only.
pagemethod calling webmethod in updateprofile.aspx is not working. Getting "undefined" exception.
Why is this so?
I have the following problem;My console app is running on the server and all I want to do is control it over ASP.NET Web Service.
I added new ASP.NET Web Service project to my Solution where my main console app and added reference to it.The problem is every time WebMethod calls function from console app, i get the nullreferenceexception. Even if I try to use static classes or singletons; every object is null, although my console app is running absolutely correctly.
I have a service that works great on my development box. It uses JQuery to hit my web service, and then the JSON results are sent back.
The web service is located on our basePage.cs. We didn't want to put out an external WebService for this. Our on beta box something different is happening.
The web page seems to be trying to call the web method correctly - the JSON data is being sent... but the server doesn't seem to know it's a webmethod. here's my service function (it's in our basepage.cs which inherits from Page).
[Code]....
i wrote a webmethod on webservice. it will do adding product to shoppingbasket. But it doesn't work. i used a class and its method in this webservice method. error is about it. my code are below:
[Code]....
[Code]....
, imagine a Master page that implements IFooMaster with a method
ShowFancyMessagePopupTheBusinessCantLiveWithout(string message);
I am in a page that inherits this master page. Upon a checkbox being unchecekd, I want to show a message to the user that if they save it, they can't re-check the checkbox without some admin action.
I've been given feedback that I can't just use an alert('message'); in javascript because they want the consistent look of these messages.
Next, I tried to make an ajax call via PageMethods (as that's what everything else in this codebase uses) to show a message. My problem lies in this method being static.
[WebMethod]
public static void ShowSuperImportantMessage()
{
if(!checkboxICareAbout.Checked)
((IFooMaster)Master).ShowFancyMessagePopupTheBusinessCantLiveWithout("If you uncheck that thing, you can't recheck it.");
}
Since ShowSuperImportantMessage() is static, I can't access Master from within. The method on the master page looks more or less like this:
public void ShowFancyMessagePopupTheBusinessCantLiveWithout(string message)
{
lblGenericMessage.Text = message;
btnGenericMessageOK.Focus();
upGenericMessage.Update();
mpeGenericMessage.Show();
}
mpeGenericMessage is an ajaxtoolkit:ModalPopupExtender.
upGenericMessage is an update panel.The other 2 are obvious.
Can I do some jQuery kung-fu to show that stuff? I tried, but the solution complained that the controls I tried to refer to by ClientID didn't resolve since they were on the Master page.
quick edit: Before anyone tells me the architecture is a problem, or I shouldn't have put such a thing on a master page, or w/e...
I know the situation is not ideal, but I this is inherited code, and I can't drop it all and rewrite half of their web stack.
I understand how to use jQuery to make an AJAX call to a WebMethod from a normal page, but I'm running into problems doing it from a UserControl (ASCX). Right now the biggest Issue I'm having is that the JavaScript for getting access to the groupDropDown control is not working. It seems that since this is a UserControl hosted within DotNetNuke, the ususal method of getting the CLientID is not working since it is nested down x number of levels. Here is what I have:
Javascript:
function validateEnrolledDate(src, args) {
var isValid;
[code]....
I'm now just referencing a TextBox:<asp:TextBox ID="dealerId" runat="server" CssClass="theDealer" />
The Text in the Textbox is being set in Server Side code, and it is visible on screen.The alert message is "undefined", so something is still happening so that it is not getting the value of that textbox...
I'm trying to implement a view tracking web service on my website. I'm using JavaScript because I want to exclude any search bots from my tracked views. The problem is I'm getting a "Unknown web method" error when I try to use jQuery to post to the web service I've created.
$(document).ready(function() {
$.ajax({
type: "POST", [code]...
The error is an ASP .NET error: Unknown web method TrackItemView. Parameter name: methodName.I've done this hundreds of times (seemingly), but I just can't see what I'm missing. I'm sure it's something small...
The message sent to browser is as follows:
The type My.API.Class is ambiguous: it could come from assembly '[on Temporary ASP.NET Files]' or from assembly '[on bin folder]'
The problem occurs when debugging a Web App, speciically when making a request to a WebMethod of a WebService.The project compiles just right. It generates My.Website.dll on bin folder and if I publish the Web Application. It works fine.The asmx file is on the root of the application. The CodeBehind file is on App_Code and its marked to be compiled to generate My.Website.dll.The way this person exposes its problem is somehow similar but I get starting to be lost when he talks about a proxy class and shared dlls I don't use.
HWhen I want to use AJAX, primarily with JQuery .ajax function, I use functions within the .aspx.cs of the same page with [WebMethod].
I dont like this method very much because everyone can tell which function I use, and with no problem they can use it too.
My guess is that theres a better way to do this, Am I right?
In the tutorial for autocomplete text box for static page method in c# the following lines of code is given. When i use it my website using c# it gives error 'invalid term "in" showing in line 7.
[System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()]
public static string[] GetCompletionList(string prefixText, int count, string contextKey) {
// Create array of movies string[] movies = {"Star Wars", "Star Trek", "Superman", "Memento", "Shrek", "Shrek II"};
// Return matching movies return (from m in movies where m.StartsWith(prefixText,StringComparison.CurrentCultureIgnoreCase) select m).Take(count).ToArray();
}
I am using autocompleteextender to receive list of projects. Is there any way that, given list of projects can hold a hidden values like a dropdownlist? I need project ID as hidden value...so that when I select a project from the list, I can retrieve the ID using C#/ASP.Net.
View 2 Repliesi have used fallowing code
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" TargetControlID="TextBox1"
MinimumPrefixLength="1" ServiceMethod="GetNameInfo" ServicePath="WebService.asmx">
</cc1:AutoCompleteExtender>........
i'm using visual web developer 2008 express edition, i added the ajax toolkit to the tools without issue. SOME tools, like the accordian (and others) allow me to drag and drop them onto my forms. but others, such as the autocompleteextender wil not allow me to drag and drop them onto a form. i just get a circle with a line through it (as if to say - this is not allowed) - why is that?
i tried coding the extender in manually like many examples i've seen online:
<cc1:AutoCompleteExtender TargetControlID="txtName" ServiceMethod="GetCustomers" ServicePath="AjaxService.asmx"
MinimumPrefixLength="1" ID="AutoCompleteExtender1" runat="server">
</cc1:AutoCompleteExtender>
but it underlines "cc1" and gives me the error: "unrecognized tag prefix"
what am i doing wrong?
I've got an AutoCompleteExtender on one of my pages, it seems to be working fine aside from this strange behaviour: Let's say I key in 2 characters, the suggestion list would display. When I press on backspace to delete those 2 characters, wait until the suggestion list to disappear, and re-enter those 2 characters, the suggestion list would no longer display (or sometimes would flicker for about a second after losing focus from the textbox) and I'll need to refresh the page just to get it working again.
However, if I do press backspace and delete those 2 characters but not let the suggestion list to disappear and re-enter new characters, it would continue displaying with correct suggestions. This behaviour seems to happen only in IE8, (although it works with IE8 using Compatibility View and Firefox)... My code is almost the same as the sample on this site except for the animations, and the service looks up in a database table.
[Code]....
I have implemented autocompleteextender on textbox, everything works fine, however please help me with this minor thing.In textbox whenever I enter a value it get stored in memory
e.g I have typed 'hello' & press enter. The next time I press 'h', 'hello' appears below it, & hides the autocompleteextender. Is there a way to switch this function of text box
I am having a problem with the AutoCompleteExtender contol that I've put up on my webpage. I have this employee page where the seach is done at the very top and I'm using this control ; The formatted name is my search key that I'm doing in my web method. Now when I am deleting an employee and reloading the page...the Formatted name still appears during the page load. I've to close the window and load it again to get the updated employee list.
<asp:TextBox
ID="txtFName"
runat="server"
[code]...
I am using AjaxAutoCompleteExtender in my asp.net program (C#) . I am applying the extender to a texbox and using internal Web Service. I am getting the desired result, when i am running from the development environment. After Publishing the site to IIS, I am not getting the list and not showing any errors. I have turned off custom errors. My website is not an Ajax Enabled WebSite. So i added the lines into my Web.Config.I tried all service path.. http://localhost/Test/ WebService.asmxhttp://192.109.1.8/Test/WebService.asmxand i tried ~/Test/WebService.aspxWhile testing from the development environment, i am using the last one.I am not sure whether this is the problem with the service path or any permission issue.
View 3 Replies