【发布时间】:2021-08-15 07:12:05
【问题描述】:
<script type="text/javascript">
function GetValue3(id) {
text1 = documnet.getElementById(input parameter from cs file);
alert("this is from cs file");
//database transactions here <-------method1
}
$(function () {
button1 = document.getElementById(input parameter from aspx file);
$("[id*=Button1]").on("click", function () {
alert("this is from aspx file");
//database transactions here <-------method2
})
})
</script>
我的问题是数据库事务有两个过程,第一个是从 aspx.cs 代码查找文件中获取参数,第二个是从 aspx 文件中获取参数。
在我的代码中,我想使用第二种方法(通过使用后面的 aspx.cs 代码中的参数)进行数据库事务,因为它在我的编码中是必需的。
请指导我如何构建这种方法。
【问题讨论】:
-
请注意您共享的代码是 javascript-> 意味着它在客户端上执行。如果您想从 webform 使用后面的代码(在服务器端执行)与数据库通信,则服务器点击事件和点击事件之间存在差异。
标签: javascript c# asp.net database