onclick要两次才执行JS:clickok(),放在page_load里不行,因为我要传值,请高手帮忙
<SCRIPT language="javascript">
function clickok()
{
returnall = document.all("txt_ID").value+","+document.all("txt_NA").value;
window.returnValue=returnall;
window.close();
return true;
}
</SCRIPT>
private void Page_Load(object sender, System.EventArgs e)
{
if (!Page.IsPostBack)
{
// 在此处放置用户代码以初始化页面
ShowAll();
}
}
private void btn_cx_Click(object sender, System.EventArgs e)
{
GYS_Bll gb = new GYS_Bll();
gb.Entity.gys = txt_DH.Text.Trim();
if(gb.getOnly() == false)
{
DataSet ds = gb.getNP();
DataRow dr = ds.Tables[0].Rows[0];
txt_ID.Text = dr["gys_id"].ToString();
txt_NA.Text = dr["gys"].ToString();
btn_cx.Attributes.Add("onClick","javascript:clickok()");
}
else
{
DataSet ds = gb.getNP();
dg_gys.DataSource = ds;
dg_gys.DataBind();
}
}
------解决方案--------------------