manipulate html in asp server side

Posted on 2013-01-09
Last Modified: 2013-01-10
I am trying to move some difficult html manipulation form javascript to the server using asp.
Is there anything I can do to take the following content and then load it into an xml or other object and manipulate, add a row, change field names, etc.?

Maybe is it  possible to run javascript on the server?

I am using an ajax call to send the table html to the asp page and returning the changed
html table to the div wrapper

The goal is to move away from jquery and javascript on the client to an easier to code server based solution.  The table is a multirow that needs have delete and add row capabilities.
Ideally, if I could take the html, convert it to xml then use dom then back.  Or just
make the html fit into the xml dom?
Question by:KeithMcElroy
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3

Author Comment

ID: 38761618
If I could do something like this and then manipulate the html using dom methods...

h = Request("datagridHTML")

sXml = h

      Dim oXml
      Set oXml = CreateObject("Microsoft.XMLDOM")
      oXml.async = false
      oXml.loadxml sXml
      set loadXStr = oXml

response.write h

Author Comment

ID: 38761652
And more, if i could...

h = Request("datagridHTML")

sXml =     h  

      Dim oXml
      Set oXml = CreateObject("Microsoft.XMLDOM")
      oXml.async = false
      oXml.loadxml sXml
      set loadXStr = oXml
      set newtr = oXml.SelectNodes("//TBODY/TR").cloneNode(true)
      set parent = newtr.parentNode

response.write h
LVL 53

Accepted Solution

Scott Fell,  EE MVE earned 500 total points
ID: 38761676
I undertand where you are coming from. You have a good feeling for asp and vb and javascript is not as intuitive from the start.   If you are going to manipulate things in the browser, it (the page loading) is really much faster to use javascript/jquery.  

With asp, you can run javascript (jscript) server side and you can create your html dynamically.  However, it can take up a lot of processor/memory on the server and slow loading times compared to getting the data to the browser and let javascript quickly move the dom stuff around.

Just as a test check out this project  Try running it as client side javascriipt.  Then run it serverside

<script language="JScript" runat="server" src='path/to/json2.js'></script>
<%@Language="VBScript" %>
Option Explicit

<script language="JScript" runat="server" src='path/to/json2.js'></script>


Dim myJSON
myJSON = Request.Form("myJSON") // "[ 1, 2, 3 ]"
Set myJSON = JSON.parse(myJSON) // [1,2,3]
Response.Write(myJSON)          // 1,2,3
Response.Write(myJSON.[0])      // 1
Response.Write(myJSON.[1])      // 2
Response.Write(myJSON.[2])      // 3

Open in new window

In the same manner you can run other javascript serverside in classic asp.  However, notice how much slower it runs.  I have tried the same with

It did take me some time to embrace javascript/jquery for the same reason.   But for what it sounds like you want to do, client side scripting is the way to go. and are good places to get started.

Author Comment

ID: 38765239
Thank you for the help and easy to digest commentary.
Really helps alot.  I am revisiting jquery for this and will look into running on the server
for when it might be needed down the road.
All good.  Thanks a mil!

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Why is PHP Storm giving me an undefined constant error? 4 58
IIS components 2 66
Clear input text 15 34
Retreiving SOAP FAULT messages using classical ASP 14 48
The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question