Hi Chris C,
I have also faced the same situation i solved this by calling
Page_ClientValidate() function before printing. Don't directly call
window.print() instead
private void Page_Load(object sender, System.EventArgs e)
{
StringBuilder myScript = new StringBuilder();
myScript.Append("<script language='Javascript'>");
myScript.Append(" function PrintForm(){");
myScript.Append(" if (Page_ClientValidate()){");
myScript.Append(" window.print();}");
myScript.Append("}");
myScript.Append("</script>");
this.RegisterStartupScript("MyScript", myScript.ToString());
Button2.Attributes.Add("onclick","javascript
:Print Form();");
}
this should help.
Regards
Ashish M Bhonkiya
"Chris C" <cm****@yahoo.com> wrote in message
news:ur*************@TK2MSFTNGP11.phx.gbl...
Hi,
how can I execute a window.print() (in javascript)
on a ASP-button control but only when all validation-controls on the page
pass the validation-test.
I tried using in the Page_Load() :
Button2.Attributes.Add("OnClick", "javascript:window.print();");
It works well ..... too well actually 'cause it always prints, even when
some validation-controls don't pass the validation-test.
any ideas ?
thnx
Chris
************************************************** ********************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP &
ASP.NET resources...