.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Home >> Code Snippets >> Ajax >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Client Request without refresh the page using Ajax. in vb.net

Posted By:kmmuthu       Posted Date: July 23, 2009    Points: 10    Category: Ajax    URL: http://www.dotnetspark.com  

Client Request without  refresh the page using Ajax. in vb.net

Your Input form
      txtUser Name-- Text BoX
      btnDetails   --Details Button
 you click  Details button.and load detail address for that customer in the same page  in address  labels...

in javascript...button click

function   loadDetails()
var userName =document.getElementById("txtUserNAme").value;

    g_httpRequest = new ActiveXobject("Microsoft.XMLHTTP");
    g_httpRequest.open('GET', "UserServerPage.aspx?UserName=" + userName, true);

function ResponseResult ()          //Return result from server side page
                if (g_httpRequest.readyState==4)
                    var r = g_httpRequest.responseText;
                ShowScriptError(e,"ResponseResult ()");

in server side page you have write this code in page load

dim     userName as string

Dim Con as sqlConnection
dim result as string
din Cmd as SqlCommand
dim sdr as SqlDatareader

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load


   userName = Request.QueryString("UserName ")

    con =new sqlconnection("connection string.......")

    cmd =new Sqlcommand("Select Address from Customer where customerName ='"+UserName+"',con)

     Rdr = Cmd.ExecuteReader()
     If Rdr.HasRows Then
      While (Rdr.Read)

catch Ex as Exception
throw Ex

End try


end sub


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply

    Read also another Resources from the same Author

Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend