I never worked with ajax.
I need to know if it is possible to use ajax to run a query on the db (sql server 2005).
My target is to run a query with refreshing the page.
Have you got any ideas?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As MarkusQ has said, it is not possible to do this directly, but you can call a web service or page method to perform the database query and return the result to the client side.
Something like this for a Page Method (this is off the top of my head and untested. I’m also making the assumption you’re using asp.net 3.5)
then call the page method from the client side. I’m going to use jQuery here
You can call it using JavaScript and the JavaScript proxy class that is generated when you set
EnablePageMethods = trueon theScriptManagercontrol.