<asp:Button ID="lblToInvoic" runat="server" OnClientClick="fff()" CssClass="btn2" Text="开发票" OnClick="lblToInvoic_Click" />
然后在页首写<script language="JavaScript">
function fff()
{
}
{
}
和在cs文件里写:
protected void lblToInvoic_Click(object sender, EventArgs e)
{
..
Response.Write("<script>window.dialogArguments[0].document.getElementById(window.dialogArguments[1]).value =\"" + strValue1 + "\";window.dialogArguments[0].document.getElementById(window.dialogArguments[2]).value =\"" + strValue2 + "\";window.dialogArguments[0].document.getElementById(window.dialogArguments[3]).value =\"" + strValue3 + "\";window.dialogArguments[0].document.getElementById(window.dialogArguments[4]).value =\"" + strValue4 + "\";window.close();</script>");
}
{
..
Response.Write("<script>window.dialogArguments[0].document.getElementById(window.dialogArguments[1]).value =\"" + strValue1 + "\";window.dialogArguments[0].document.getElementById(window.dialogArguments[2]).value =\"" + strValue2 + "\";window.dialogArguments[0].document.getElementById(window.dialogArguments[3]).value =\"" + strValue3 + "\";window.dialogArguments[0].document.getElementById(window.dialogArguments[4]).value =\"" + strValue4 + "\";window.close();</script>");
}
是一样的。
只是代码位置不同。