protected void btnCreateRecvInvoice_Click(object sender, EventArgs e) { StringBuilder sb = new StringBuilder(); // input array foreach (GridViewRow row in lstOrders.Rows) { CheckBox cb = row.FindControl("cbSele") as CheckBox; if (cb != null && cb.Checked) { sb.Append(cb.Text); sb.Append(','); } } if (sb.Length > 1) sb.Remove(sb.Length - 1, 1); int agentID = PageTools.GetSavedId("AgentID", null); AgentOrderBiz biz = new AgentOrderBiz(); int r = biz.NewReceiveInvoice(PageLogic.CurrentUserID, agentID, sb.ToString()); if (r == 0) { Response.Write(@" <script type='text/javascript'> alert('Create Receive Invoice ERROR! Please Check.'); location = 'AgentOrders.aspx'; </script>"); Response.End(); } else Response.Redirect("AgentRecvInvoice.aspx?recv=" + r.ToString()); }