Click here to Skip to main content
Sign Up to vote bad
good
See more: JavascriptC#3.5
how to get data in sql 2005 using javascript in asp.net
 
and show in gridview
Posted 5 Jun '12 - 22:23
sonutak618


3 solutions

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
  Permalink  
YOu can use raw-ajax function to get value from server
which uses XML Object
i.e.
 
 

 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...
  Permalink  
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.
  Permalink  

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 414
1 Arun Vasu 253
2 OriginalGriff 200
3 CPallini 163
4 Aarti Meswania 158
0 Sergey Alexandrovich Kryukov 10,169
1 OriginalGriff 7,749
2 CPallini 4,181
3 Rohan Leuva 3,482
4 Maciej Los 3,089


Advertise | Privacy | Mobile
Web03 | 2.6.130523.1 | Last Updated 6 Jun 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid