<html>
<head>
<script language="javascript">
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.load("solu.xml")
//alert(xmlDoc.xml)
var orderlist = xmlDoc.getElementsByTagName("ORDER-LIST")
var orderListLen = orderlist.item(0).childNodes.length
for(i=0;i<orderListLen;i++)
{
var childNodes = orderlist.item(0).childNodes(i).nodeName
var attribProdId= orderlist.item(0).childNodes(i).getAttribute("Prod uct_Id")
var attribProdName=orderlist.item(0).childNodes(i).get Attribute("Product_Name")
var attribPrice = orderlist.item(0).childNodes(i).getAttribute("Pric e")
document.write("( " + attribProdId + " ) " + " <a href='#' id='" + i + "'name='" + attribProdId + "' onclick='changeData(this.id)'>" + attribProdName + "</a> Price = " + attribPrice + "<br>")
}
function changeData(Id)
{
var SetPrice = parseInt(prompt("Enter the new Price for this product : ",""))
var SetProdName = prompt("Enter the new Name for this product : ","")
//The new Price and Product Name would be saved here
orderlist.item(0).childNodes(Id).setAttribute("Pro duct_Name",SetProdName)
orderlist.item(0).childNodes(Id).setAttribute("Pri ce",SetPrice)
//Update the xml file
xmlDoc.save("solu.xml")
alert("New Price = " + SetPrice + " New Product Name = " + SetProdName)
window.location.reload(1)
}
</script>
</head>
<body>
</body>
</html>
If u can get the hint from the above code u can surely go ahead and do it in ASP.NET. What u need to do is generate hyperlinks or whatever using ASP.NET and add an "onclick" event using ASP.NET and then call a function called changeData(Id) using the same and the rest can be done using javascript. Any other queries are welcome.
Regards
Wilbur J. Pereira
|