我想从JavaScript调用一个代码隐藏方法。这是场景:用户将看到消息框,他/她可以选择是或否。如果用户从消息框中选择是,我想在其他代码中调用Delete方法,我想调用Insert方法。 这是JS:
<script type="text/javascript" language="javascript">
function Func() {
var result = confirm('Are you sure you want to delete?');
if (result) {
//click ok button
//Call the Delete Method
}
else {
//click cancel button
//Call the Insert method
}
}
</script>
这是我的代码隐藏的样子:
protected void Delete()
{
//delete code here
}
protected void Insert()
{
//insert code here
}