.net前台js触发后台事件

相关主题
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

使下拉框不触发window.onbeforeunload

Js:

window.onbeforeunload = function() {

if (document.getElementById("Hidden1").value == "") {

window.event.returnValue = "确定要离开,放弃保存?";

}

}

function test() {

document.getElementById("Hidden1").value = "1";

}

前台js触发后台事件

上面Select的onchange="ToBehindFunction()"

function ToBehindFunction()

{

document.getElementById("Submit1").click();

}

后台

protected void Submit1_ServerClick(object sender, EventArgs e)

{

this.sourceProject.SelectParameters["condition"].DefaultValue = "Plid='" +

this.DropDownList2.Value + "'";

this.ddlProject.DataBind();

string aa = this.ddlProject.Text;

if (this.ddlProject.Text != "")

{

this.DropDownList1.SelectedValue = (new

ProjectService()).GetProjectById(int.Parse(this.ddlProject.SelectedValue)).State.ToString ();

}

else

{

this.DropDownList1.SelectedValue = "3"; }

}

相关文档
最新文档