点击一个按钮,我调用了一个 JavaScript 函数。获得值后,我需要从代码隐藏中获得的值中执行一些操作。我应该如何调用代码隐藏?
我的aspx:
function openWindow(page) {
var getval = window.showModalDialog(page);
document.getElementById("<%= TxtInput.ClientID %>").value = getval;
//After this I need to perform stuff 'Upload(TxtInput.value)' into database from the code-behind
}
调用该函数的按钮按如下方式设置:
<button class="doActionButton" id="btnSelectImage" runat="server" onclick="openWindow('../rcwksheet/popups/uploader.htm')">Select Image</button>
我想要的代码背后(VB):
Public Sub btnSaveImage_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSelectImage.ServerClick
Dim inputFile As String = Me.TxtInput.Value
//do more stuff here
End Sub
所以:
- 有没有办法从 JavaScript 调用代码隐藏?
- 我可以以某种方式使用按钮的“onclick”属性首先转到 JavaScript,然后转到代码隐藏吗?
- 触发 TxtInput.Value 的代码隐藏调用“onchange”?