3

I have an asp.net user control on which I want to use jquery ajax. It's basically a pop-up form which allows users to enter a name on an auto-complete control. I don't know how to make this happen using jquery ajax, because in the ajax jquery call i'm supposed to put in a page name in the url: section, and then the method to call. However, I want to put the method in the .cs file of the user control. Is there a way to make it happen, or do I have to create a page just to hold the ajax methods?

3 Answers 3

3

A user control is different from a page, so you can't call it from your jquery. If you're using Asp.Net AJAX you can put the method in a page method. Otherwise you should put it in a webservice.

Sign up to request clarification or add additional context in comments.

1 Comment

I think he'll definitely want to use a webservice
1

ICallbackEventHandler is the better option if you do not want to use webservice. It internally makes an ajax call.

Detail about ICallbackEventHandler can be found at:

http://msdn.microsoft.com/en-us/library/system.web.ui.icallbackeventhandler.aspx

The example of it, in UserControl, can be found at:

http://www.codeproject.com/Articles/27172/The-ICallbackEventHandler

Comments

0

Be careful with "Ajax Request Call" in user control to other resources (web services in this case), If you call a service from your control to outside of you application (another domain) you probably face with "Cross Domain Ajax Request" !!!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.