Rufen Sie JavaScript aus dem Code im ASP.NET -Webformular an
Posted: 16 Mar 2025, 22:53
Ich brauche Hilfe, um diese JavaScript -Funktion aufzurufen, nachdem GridView2 mit Informationen aus einer SQL -Abfrage aktualisiert wurde. Die GridView -Aktualisierung der Datenbank ist kein Problem, und ich kann eine Schaltfläche verwenden, um die JavaScript -Funktion manuell aufzurufen. Ich möchte jedoch die Funktion automatisch aufrufen, wenn die GridView aktualisiert wird. Das JavaScript muss auf der Client -Seite ausgeführt werden, es fügt Objekte zu einer drei.js -Szene hinzu, die Daten in der GridView beziehen sich nur auf den Dateiweg, einen eindeutigen Objektnamen und Koordinaten. Ich weiß
Code: Select all
function yourJavaScriptFunction(rowIndex) {
var x = rowIndex;
var file_path = getCellValue(x, 7); // Get the value from the second row, third column
if (file_path) {
console.log("Cell value: " + file_path);
} else {
console.log("Row or cell not found, get filepath."+ ' '+file_path);
alert("Row or cell not found,get filepath.");
}
var object_name = getCellValue(rowIndex, 1);
if (object_name) {
// alert(object_name);
console.log("Cell value: " + object_name);
} else {
console.log("Row or cell not found, get object name.");
alert("Row or cell not found, get object name.");
}
// alert('Button in row ' + rowIndex + ' clicked!');
//alert(value);
module.add_Object(file_path, object_name);
//add_Object();
// mytest.add_Object();
return false; // Prevent postback if needed
}