<JavaScript> function open_win() { var s=document.getElementById("txtQty"); window.open("../Stock/IPurchaseDetail.aspx","_blank","toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, copyhistory=yes, width=400, height=400"); } </javascript> <asp:CheckBox runat="server" ID="chkGenerateSerialNumber" AutoPostBack="true" CausesValidation="false" OnCheckedChanged="chkGenerateSerialNumber_CheckedChanged" />
protected void chkGenerateSerialNumber_CheckedChanged(object sender, EventArgs e) { if (chkGenerateSerialNumber.Checked == true) { Session["NoOfRows"] = txtQty.Value; System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append(@"<script language='javascript'>"); sb.Append(@"open_win();"); sb.Append(@"</script>"); ScriptManager.RegisterStartupScript(this, this.GetType(), "javascript", sb.ToString(), true);// it does work but in open_win() method window.open("../Stock/IPurchaseDetail.aspx","_blank","toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, copyhistory=yes, width=400, height=400"); does not get call } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { NoOfRows Convert.ToInt32((string)HttpContext.Current.Session["NoOfRows"]); } }
function open_win() { var s = document.getElementById("txtQty"); var url = "../Stock/IPurchaseDetail.aspx?txtQty=" + encodeURIComponent(s.value); window.open(url, "_blank","toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, copyhistory=yes, width=400, height=400"); }
function open_win() { var hWin = window.open("", "hWinPurchase","toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, copyhistory=yes, width=400, height=400"); var frm = document.getElementById('YOUR_FORM_NAME'); frm.target = "hWinPurchase"; frm.submit(); }
<form id="form1" runat="server" target="_blank"> <!-- Add your buttons herere --> </form>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)