嗨,这是我的 aspx 页面,正在向用户控件加载一些值
protected void Page_Load(object sender, EventArgs e)
{
}
这是我在查找单击事件中加载和发送值的用户控件
protected void BtnFind_Click(object sender, EventArgs e)
{
Usr_BPOP BPOP = (Usr_BPOP)Page.LoadControl("~/Usr_BPOP.ascx");
BPOP.Date = txtDate.Text.Trim();
BPOP.DocNo = txtDocNo.Text.Trim();
BPOP.Code = txtCode.Text.Trim();
BPOP.Name = txtName.Text.Trim();
BPOP.Partcode = txtPartNo.Text.Trim();
if (chkReprint.Checked)
{
BPOP.BtnReprintVisible = true;
BPOP.BtnSaveVisible = false;
}
divControls.Controls.Clear();
PlaceHolder1.Controls.Add(BPOP);
}
这是我的 Usr_BPOP.ascx:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
btnReprint.Click += new EventHandler(btnReprint_Click);
}
btnReprint.Visible = false;
btnSave.Visible = BtnSaveVisible;
btnReprint.Visible = BtnReprintVisible;
if (btnReprint.Visible == false)
{
btnReprint.Text = "Print";
btnReprint.Visible = true;
}
table = new DataTable();
table.Columns.Add("DocNum", typeof(string));
table.Columns.Add("DocEntry", typeof(string));
table.Columns.Add("LineNum", typeof(string));
table.Columns.Add("PartNo", typeof(string));
table.Columns.Add("ItemDesc", typeof(string));
table.Columns.Add("QTR", typeof(string));
table.Columns.Add("QTP", typeof(string));
table.Columns.Add("Chk", typeof(bool));
table.Columns.Add("BarCode", typeof(string));
Datalayer dl = new Datalayer();
DataTable dttable = new DataTable();
if (!BtnSaveVisible && BtnReprintVisible)
BtnSaveVisible = true;
dttable = dl.GetPOItem(date, docNo, code, name, partcode, BtnReprintVisible, !BtnSaveVisible).Tables[0];
foreach (DataRow dr in dttable.Rows)
{
table.Rows.Add(dr["DocNum"].ToString(), dr["DocEntry"].ToString(), dr["LineNum"].ToString(), dr["PartNo"].ToString(),
dr["ItemDesc"].ToString(), dr["QTR"].ToString(), dr["QTP"].ToString(), Convert.ToBoolean(dr["Chk"]), dr["Barcode"].ToString());
}
if (table != null && table.Rows.Count > 0)
{
grdlistofitems.DataSource = table;
Session["Table"] = table;
grdlistofitems.DataBind();
}
else
{
}
}
这是当我 cilck 此事件未触发时的重印按钮单击事件:
void btnReprint_Click(object sender, EventArgs e)
{
}