Json string from vb.net to asp.net

How can I get my JSON string for my asp.net using jquery. I am confused about using web methods or arrays or functions. All the examples I've seen are in C #. All I want is to take a 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 Sub

I want to take either jsonstring or myobject to the server. jsonstring is json and myobject is xml. Thus, I can create a client part of the table that will include mathematical functions. I am very new to this, so I need a clear explanation and maybe even an example. I read about pagemethods and I tried to use this example when calling functions on the server side example

Or you can tell me an easy way to switch from sql to ajax. What is the best way to host large datasets on an asp.net page without using a search call.

I basically rewrite the asp page they are using now to use ajax because it loads slowly, here is an example of the current asp code and what I'm trying to achieve.

                response.write("<tr><td>")

            %><font face="Arial,Helvetica,sans-serif" size="-2"><%
            response.write(rscontest.fields.item("book7"))
            response.write("</td><td>")

            %><font face="Arial,Helvetica,sans-serif" size="-2"><%
            response.write(rscontest.fields.item("dep7"))
            response.write("</td><td>")

            %><font face="Arial,Helvetica,sans-serif" size="-2"><%
            response.write(rscontest.fields.item("lead"))
            response.write("</td><td>")

            %><font face="Arial,Helvetica,sans-serif" size="-2"><%
            response.write(rscontest.fields.item("hear"))
            response.write("</td><td>")

            %><font face="Arial,Helvetica,sans-serif" size="-2"><%
            response.write(rscontest.fields.item("cname"))
            response.write("</td><td>")

%><font face="Arial,Helvetica,sans-serif" size="-2"><%


response.write(rscontest.fields.item("theme") & " - " & rscontest.fields.item("tour"))
            response.write("</td><td align='right'>")

            %><font face="Arial,Helvetica,sans-serif" size="-2"><%
            response.write(rscontest.fields.item("userid"))
            response.write("</td><td align='right'>")

            %><font face="Arial,Helvetica,sans-serif" size="-2"><%
            response.write(rscontest.fields.item("pax_count"))
            pax = pax + rscontest.fields.item("pax_count")
            response.write("</td><td align='right'>")

            %><font face="Arial,Helvetica,sans-serif" size="-2"><%
            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("<tr><td rowspan=1>")    
        %><font face="Arial,Helvetica,sans-serif" size="-2"></style><%
            response.write(rscontest.fields.item("description"))




            rscontest.movenext

        wend

all he writes is the sql statement, and he uses the current amount.

+3
source share
3 answers

Read this SO thread first , if that doesn't work, read on.

I'm not sure why you want to pass json after you receive it if from webservice, but the following steps should get you there:

  • - ( HelloWorld )
  • - javasscript (jQuery $.ajax() )
  • xml (json), -, ( asp: HiddenField, , )
  • - , .

, . " ", .

+2

Body ASP.NET onload, Javascript, Ajax ( JQuery ( ServiceReference ScriptManager) web-. ( javascript) JSON. , JSON.

+1

, json ajax, , sql. , html . ?

- , - -, - ( SQL). (JSON) , , .

, , LINQ, (.. 5000 , 100 1, .). - , , , . .

+1

Source: https://habr.com/ru/post/1774615/


All Articles