方法一:不推荐
1. 前台textbox属性AutoPostBack="true";
2.后台
protected void Page_Init(object sender, EventArgs e)
{
txtVehicleNum.TextChanged += new EventHandler(txtVehicleNum_TextChanged);
}
void txtVehicleNum_TextChanged(object sender, EventArgs e)
{
DangerClassDataBind();
}
1.后台
protected void Page_Init(object sender, EventArgs e)
{
txtVehicleNum.Attributes["OnBlur"] = ClientScript.GetPostBackEventReference(btnTemp, null);
}
void btnTemp_Click(object sender, EventArgs e)
{
DangerClassDataBind();
}
方法三:推荐
1.js:
//选择车辆
function openSelectVehicleWindow() {
var returnValue = window.showModalDialog("VehicleInfo_Select.aspx", window, "dialogWidth:1000px; dialogHeight:500px; status:no; directories:yes;scrollbars:no;Resizable=no;help=no");
if (returnValue != null) {
var strvalue = returnValue.split('|');
document.getElementById("<%=txtVehicleNum.ClientID %>").value = strvalue[0];
document.getElementById("<%=txtPlateColor.ClientID %>").value = strvalue[1];
document.getElementById("<%=txtPlateColorName.ClientID %>").value = strvalue[2];
document.getElementById("btnTemp").click();
}
}
2.后台
void btnTemp_Click(object sender, EventArgs e)
{
DangerClassDataBind();
}