How can I pass additional parameters to the web service or how can I call a method in the code behind page.

I have done a ton of research in this area and there just does not seem to be a way to pass any addiional parameters to the Web Service reference in the autoextneder call.  Is there a way that this can be done.  In my world, the list of suggestion is dependant on other data on my web form or web user control.   I had read some references that you might be able to call a method in the code behind page, however everything i have tried on this has failed.  Here is a list of what I have attempted

 Tried to add query string arguments to the service path property (error is thrown trying to render the page)

Tried to set the service path to a web page (aspx) and then call the code behind method (this also threw error trying to render the page)

Viewed some alternative solutions from vrious posts...however most we out of date t the current release (RC1).

I see that David Reed has an example at Infiinity Loop, however his server is unavailable at this time.

I would love for the auto extender to be able to natively support calling the code behind method of the page or user control that is using it.  It would seem logical that the derived suggestion should be able to present a filtered list based on other data.  It would be nice if I could pass it an array of string that represent name value pairs of data that I can then access in the web service and pass to whatever is building the list.  Anyway just a suggestion...maybe the functionality is there and I just can not figure it out

 Please help

 

0
JohnJordan
12/27/2006 6:36:52 PM
asp.net.networking-webservices 2181 articles. 0 followers. Follow

3 Replies
1270 Views

Similar Articles

[PageSpeed] 52

>> I have done a ton of research in this area and there just does not seem to be a way to pass any addiional parameters to the Web Service reference in the autoextneder call.  Is there a way that this can be done.  In my world, the list of suggestion is dependant on other data on my web form or web user control.

With some digging around in the AutoCompleteExtender you may be able to modify the javascript to do this - I've never looked at it personally but that is where I would start.  You would need to hijack that part that reads from the target control and add other data to the call. 

 >> I had read some references that you might be able to call a method in the code behind page, however everything i have tried on this has failed.

The following RC1 example of using a page method works on my system, but it's not going to solve your problem.  The page method has to be static, so you won't be able to access any form data.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="BenValidationControls" Namespace="ben" TagPrefix="hauna" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<script runat="server">
    [System.Web.Script.Services.ScriptMethod]
    [System.Web.Services.WebMethod]
    public static string[] AutoCompleteMethod(String prefixText, int count)
    {
        return new string[] { "foo", "baz" };
    } 
</script>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" />
        <div>        
            <asp:TextBox ID="TextBox1" runat="server" />
            <asp:AutoCompleteExtender ID="AutoCompleteExtender1" 
                ServiceMethod="AutoCompleteMethod" 
                ServicePath="~/default.aspx" 
                TargetControlID="TextBox1" 
                MinimumPrefixLength="1"
                runat="server" />
        </div>
    </form>
</body>
</html>
 
0
haunaben
12/28/2006 10:51:43 AM

Thanks for the response.  I am looking at modifying from the jvavascript as you have suggested.  Here is also what I have found out...

First off the code behind must be in an aspx page and not in a ascx.  I am not sure why that should matter but apparently it does.  it would be really be nice if I could reference the code behind on either type of file.  If you are trying to make a reusable control within your app with the auto complete extender then this is somewhat limiting.  Also what I did not know or see document anywhere that this function needed to be static.   Once I did that it started working quite well.

 Thank you very much on this.  This actually helped quite a bit.

0
JohnJordan
12/28/2006 1:35:30 PM

You were referring to my derived AutoCompleteExtender that enables callbacks... I had some server issues but its back up and running :) This would solve your problem perfectly.

http://weblogs.asp.net/infinitiesloop/archive/2006/11/15/ASP.NET-Ajax-Beta_3A00_-AutoCompleteBehavior-without-a-Web-Service.aspx

 


End the confusion.
Infinities Loop: TRULY Understanding ViewState
.NET from a new perspective.

This posting is provided "AS IS".
0
InfinitiesLoop
12/29/2006 9:37:49 PM
Reply:

Similar Artilces:

Can I call a WebService method from a code behind page?
I made a simple WebService to fetch info from a database.  For testing purposes, I'd like to populate a text field on my default.aspx page on a button click.  I realize the standard way to do this is with JavaScript, but can't I just call that method in the onClick handler in my code behind page?  Won't VS create the javascript code I need?  I have a script handler, etc. <asp:ScriptManager ID="ScriptManager1" runat="server"> <Services> <asp:ServiceReference pa...

Can you return .net web controls in a .net page from a web service?
I've got a problem with a project. I've got to compile an entire .net page and return it as part of a Web Service for display. The problem I have is that I need to add WebControls and functionality to the page so that not only the html content and images are displayed (which I've managed) but that textboxes, labels, buttons and datasets can be displayed also. Essentially I need to make a call from one site for a page, populate the page and return it in a state as though it resided on the same server/webspace as the calling page. Code is currently built as follows into a string: strOpenHT...

how can i convert code behind web forms pages to inline code pages
hi all of you, I have a problem, a have registered a free asp.net space at Brinkster , so i can just upload my files there one by one, but can not install my web application directly, and i have to upload my projects there, so one way is o convert all my VS.NET web application which is code behind, convert that into inline code, so how can i do that Thanks in advanceWarm Regards,Prajesh Kumar JhaE-MAIL : prajesh.jha@rediffmail.com Convert from Code-Behind to Code-Inline: http://www.codinghorror.com/blog/archives/000174.html Darrell Norton, MVPDarrell Norton's BlogPlease m...

how can I call a method in static web service method?
I have a web service method like below that I want to call a edit method in it, hiw can I do that?it cuse error in it.[WebMethod] public static string getText() { } and a method like this?  public void edit() { int a=textbox1.text  } thanx Either you have to declare edit() also as static or create an object of the class and call edit. Hi  sepideh_adi, If you want to use method of webservice, you should reference it firstly. WebSite->Add WebReference->Fill webservice url and webrefernce Name. Then you can use the webservice. webrefernceName tt=new webref...

Can you call a web service from a web service?
I am trying to create a web service that itself consumes a 3rd party web service outside of our corporate firewall - so basically a web service consuming another web service.  I can consume this outside web service directly in an ASP.NET application without a problem.  But because the code is long and cumbersome, I wanted to provide our GUI developers an easy way to get all of the data they need from one source.  So I thought I could create an internal web service that would do a lot of things (query internal systems, for example) as well as consuming this external service.&nb...

can i refer from the autocomplete web service(or page method) to other controls on the page ?
i want to be able to read the value of a textbox control from within the autocomplete web service (or page method) but i doesn't recognize this controls directly. can it be done ?   Not like I think you want. How would the remote web service know the text in the textbox?http://blogs.msdn.com/DelayThis posting is provided "AS IS" with no warranties, and confers no rights....

Can i setup endpoints in my web config so i can call my wfc ajax web service from both the client and the server?
I am having trouble setting up a webHTTPbinding endpoint and a wsHTTPbinding endpoint on the same site so i can call my web services from the client or server.  Seems to work fine i chose one or the other, has anyone else tried to do this?  Thanks for any help. Wayne...

Can WSE 3.0 Web Service be exposed to the web and can it be consumed by non .Net apps?
If I write a WSE 3.0 web service in .Net 2.0, can I expose it to the web like an IIS XML web service.?Also, can this web service be consumed by non .Net apps or .Net 1.1. apps?sun21170 Yes, simply enable your web service project for WSE 3, and this will alter web.config to support WSE 3 web services in IIS.The web service can be consumed by non .Net clients, however .Net 1.1 clients may struggle unless you add WSE support ans generate specific WSE proxies at the client end.  JamesMy Blog: http://www.wintersfamily.plus.com/blogs/JamesWinters...

How can I open a .Net web applicaiton from a web service page and return values
 Hi allhere is what I need from an Oracle jdeveloper form, click on a button, open a web application in .Net, let the user choose several options and calculate a Total Amount, return the total amount to the jdeveloper application,could it be done with a web service?the Oracle jdeveloper form calls a web service that opens my .Net  web applicationmy web application returns a Total Amount value, my web service returns the Total Amountthe jdeveloper form gets the Total Amountthanksjsn     jsn1:  Hi all here is what I need  from an Oracle jdeve...

Can I have a web user control call a method on the page it's parent page?
I'm building an application where I'm using serveral different controls on a page and as one of them causes a postback I may want the page to make changes to other controls.  Is there a way to either fire and event off from the control that the page could then capture or simply have the control call a method of it's parent page? Obviously the Page object is there to work with, but I can't seem to figure out how to specifically cast it as a specific page.  For real man, In your user control you need to create a public event which is raised by the event of the...

How can I pass parameter from client to web service
 Hi, How can I pass parameter to web service side, below code is fine, but just return all field, if I put product id on textbox and pass it to web service side and respond to client, how can I modify the codes in "default.aspx.vb" and "Product.vb" file.   client side   "default.aspx" <html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server">    <title>Untitled Page</title></head><body>    <form id="form1" runat="serve...

Can I access .net web service by java code?
Can I access .net web service via java code? Have you tried it before? I need some advice or example. Many thanks for that. you can use AXIS to access .NET web services. http://ws.apache.org/axis/java/developers-guide.html  HTHThajeer"Dont forget to click "Mark as Answer" on the post that helped you. This marks your thread as Resolved and the community will know you have been helped."...

Can we declare static methods in web services in .Net
Hi,           I created a static method in the webservice. It compiled well but the static method is not exposed while trying to consume the webservice.If I declare the method as object method,its working. Any reason for this.   Also,  I created properties in the webservice . Properties also,I am not able to access for consumption. Please tell me whether its invalid to use static methods and properties in a web service and the reason. I might be asking some trivial question but as I am new to .Net webservices,I don't know these. ...

How can i Ignore optional parameter in Web Method call
I am trying to call web method without optional parameter value via HTTP Get method. but by doing so i get error like There is three parameter in my web method call Name,BirthDate1 and Birthdate2 If I have called web service by below URL http://localhost:3933/ChartWheelWebservice/service.asmx/WheelChart?Name=adday&Date=12-05-1960&Date2=12-05-1960, then its work fine but if i remove parameter name from URL like http://localhost:3933/ChartWheelWebservice/service.asmx/WheelChart?Date=12-05-1960&Date2=12-05-1960, then i get below error System.InvalidO...

Web resources about - How can I pass additional parameters to the web service or how can I call a method in the code behind page. - asp.net.networking-webservices

Category:Articles needing additional references from November 2011 - Wikipedia, the free encyclopedia ...
This is an administration category . It is used for administration of the Wikipedia project and is not part of the encyclopedia. It contains ...

Michael E. Mann - Some additional thoughts about Muller... - Facebook
Some additional thoughts about Muller and 'BEST': Muller's announcement last year that the Earth is indeed warming brought him up to date w/ ...

BranchOut raises additional $25M for professional networking app
BranchOut , a professional networking app built on top of Facebook, announced today that it raised $25 million in a Series C round lead by Mayfield ...

Swytch - Additional Numbers for Calls & Texts on the App Store
Read reviews, compare customer ratings, see screenshots, and learn more about Swytch - Additional Numbers for Calls & Texts. Download Swytch ...


TSA Interaction @ DIA Additional Body Screening After Landing???? - YouTube
They tried to get me to do additional screening of my Body after I was already off the plane and headed out of the airport. I ended up leaving ...

AGL faces delays, additional conditions after BTEX chemicals detected
AGL's coal seam gas ambitions in the Gloucester area have been dealt a double blow with the launch of two government investigations into the ...

Making additional contributions to super
Can I make additional contributions to super if the account is in the pension phase

Hunt for additional Paris attacker
FRENCH authorities are now hunting at least one additional attacker after surveillance video showed three men in a car used for an assault on ...

Pistorius to face additional gun charges
Sky News is Australia's leader in 24-hour news. South African Paralympic champion Oscar Pistorius is facing two additional gun-related charges ...

Resources last updated: 12/27/2015 3:48:22 PM