json string from vb.net side to asp.net

How would I get my JSON string to my asp.net using jquery I am confused about using web methods or arrays or functions all the examples i have seen are in C#. All i want is to take the json string parse it.Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load cmd.Connection = …

via Asp.Net Developed Tutorials » Search Results » ajax:

json string from vb.net side to asp.net

How would I get my JSON string to my asp.net using jquery I am confused about using web methods or arrays or functions all the examples i have seen are in C#. All i want is to take the json string parse it.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
cmd.Connection = conn
conn.Open()
Dim ds As New DataSet
cmd.CommandText = “MY SELECT STATEMENT IS IN HERE(DIDNT WANT TO POST ONLINE)”
da.Fill(ds)
da.FillSchema(ds, SchemaType.Mapped)
Dim myObject = ds.GetXml
Dim jsonString = New JavaScriptSerializer().Serialize(myObject)
conn.Close()
End SubI want to take either the jsonstring or myobject to the server side. jsonstring is json and myobject is xml. That way I can create a table client side that will include math functions. I am very new at this so I would need a clear explanation and maybe even an example. I have read about pagemethods and I have tried using this example on calling server side functions example
Or can you tell me a simple way to go from sql to ajax. What is the best method for placing large datasets on a asp.net page without using paging.
I am basically rewriting an asp page that they use now to use ajax, because it loads to slow, heres an example of the current asp code and what I am trying to achieve.
response.write(“

“)

%><%
response.write(rscontest.fields.item(“book7″))
response.write(“ “)

%><%
response.write(rscontest.fields.item(“dep7″))
response.write(“ “)

%><%
response.write(rscontest.fields.item(“lead”))
response.write(“ “)

%><%
response.write(rscontest.fields.item(“hear”))
response.write(“ “)

%><%
response.write(rscontest.fields.item(“cname”))
response.write(“ “)

%><%

response.write(rscontest.fields.item(“theme”) & ” – ” & rscontest.fields.item(“tour”))
response.write(“ “)

%><%
response.write(rscontest.fields.item(“userid”))
response.write(“ “)

%><%
response.write(rscontest.fields.item(“pax_count”))
pax = pax + rscontest.fields.item(“pax_count”)
response.write(“ “)

%><%
IF rscontest.fields.item(“status”) = “XL” then
response.write(formatnumber(rscontest.fields.item(“CXVALUE”),2))
sales = sales – formatnumber(rscontest.fields.item(“CXVALUE”),2)
ELSE
response.write(formatnumber(rscontest.fields.item(“AMOUNT”),2))
sales = sales + formatnumber(rscontest.fields.item(“AMOUNT”),2)
END IF

response.write(“

“)
%>

<%
response.write(rscontest.fields.item(“description”))

rscontest.movenext

wendanything it is writing is from an sql statement, and it uses a running total.
…………………………………………

First, read this SO thread, if it doesn’t help – read on.
I’m not sure why you want to pass the json around after you get if from the webservice, but the following steps should get you there:
Create a webservice (start with a default HelloWorld service from the template)
Call the webservice from javasscript (jQuery’s $.ajax() does just that)
Assign the xml (json) that you get from the webservice to a hidden field (use asp:HiddenField to make sure it’s available on the server)
In your code behind – get the value of the hidden field, and do what you have to do with it.
You should really rephrase your question, and tell us what the ultimate goal is. When you say “I want to build a table”, that doesn’t mean anything.
…………………………………………

In your Body tag in ASP.NET put an onload attribute that calls a Javascript function that makes the Ajax call (you can use JQuery or do it manually (just don’t forget to put a ServiceReference in your ScriptManager) to a web service method. The return method (in javascript) will then have to parse the JSON. If you’re going to build the tables on the server side there is no point in serializing the object into JSON.
…………………………………………

I have a large dataset, so wouldn’t using the json and ajax make my page load faster, rather than using sql. Also the reason is I want to format my information using html and tables. Is this the right direction?
Whether you pull the data from a web service call on the client or server side you are still loading it through a web service that has to retrieve it from some back end data store (i.e. SQL). Using a client side approach (JSON) will make the delivery of the page quicker but the user will still wait for the overall load which the data is being delivered to the client.
From a performance stand point you would probably want to look into LINQ to deliver only the page of data that you need (i.e. There are 5,000 records and the user is only viewing the first 100 on Page 1, so only return Page 1). Its a pit fall alot of new developers fall into and is a bit complex but you seem to have the appetite for it. Good luck.

For more info: json string from vb.net side to asp.net

Asp.Net Developed Tutorials » Search Results » ajax

json string from vb.net side to asp.net

Share this post:

Related Posts

Leave a Comment