Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to get data in sql 2005 using javascript in asp.net

and show in gridview
Posted

One known method is using AJAX to read data. You should have your server side logic to fetch data. Then you can use your AJAX class to load data to grid .

Regards
Sebastian
 
Share this answer
 
YOu can use raw-ajax function to get value from server
which uses XML Object
i.e.

JavaScript
function getValueByAjax(url,getxml)
   {


       var req;
       try {
        req = new XMLHttpRequest();  //e.g. Firefox
        } catch(err1) {
          try {
          req = new ActiveXObject('Msxml2.XMLHTTP'); // some versions IE
          } catch (err2) {
            try {
            req = new ActiveXObject("Microsoft.XMLHTTP"); // some versions IE
            } catch (err3) {
             req = false;
            }
          }
        }

       req.open("GET", url  ,false);

       req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

       req.send();
       var item ;
       if(req.readyState == 4)
       {
          if(req.status == 200)
          {
             item = req.responseText;
             if(getxml==1)
             {
                item = req.responseXML;
             }
          }
       }

        return item;
   }

and do process from server side

and manupulate returned string as you want...
 
Share this answer
 
get data in sql 2005 using javascript
Database will be on server side. So you need to use techniques that will allow you to talk to server from JavaScript.

There are few ways to interact with server side through client side(Javascript):
1. XMLHttpRequest[^]
2. Callback[^]
3. WebService call[^]
4. PageMethod[^]

Try the one that suits you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900