我有一个变量,我在 JavaScript 中计算它的值。我想将该变量传递给 C# 以删除数据库中的记录。这是我现在正在使用的代码:
<div>
<h4>Example 2</h4>
<div class="indent">
<p class="center"><img src="assets/ex2.jpg" /></p>
<p class="right">
<button onclick='
$.msgbox("Are you sure that you want to permanently delete the selected element?",
{
type: "confirm",
buttons : [
{type: "submit", value: "Yes"},
{type: "submit", value: "No"},
{type: "cancel", value: "Cancel"}
]
},
function(result) {
$("#result2").text(result);
}
);
'>
Example 2
</button>
<input id="inpHide" type="hidden" runat="server" />
<asp:Button ID="Button2" runat="server" Text="Button" onclick="Button2_Click" />
Result: <span id="result2"></span>
</div>
如何将变量从 JavaScript 传递到 C#?