Hello
Can i merge 2 button (code) in 1
First i must check users, then calculate total users, second open new window popup
<asp:Button ID="btnCount" runat="server" Font-Bold="True" Font-Names="Arial" Font-Size="14pt" AutoPostBack="true" OnClick="OnCount" Text="حصر المهندسين والاشرافين" />
<asp:Button ID="btnShow0" runat="server" Text="نموذج بدل موقع" Font-Bold="True" Font-Size="16pt" OnClick="ShowRDLCbtn" Font-Names="Arial" CssClass="auto-style51" BackColor="#0066FF" />
protected void OnCount(object sender, EventArgs e)
{
DataTable dt = new DataTable();
dt.Columns.Add("OPsec");
foreach (GridViewRow row in GridView1.Rows)
{
CheckBox cbRow = row.FindControl("CheckBox1") as CheckBox;
if (cbRow.Checked)
{
string OPsec = row.Cells[6].Text;
dt.Rows.Add(OPsec);
}
}
GetCounts(dt);
protected void ShowRDLCbtn(object sender, EventArgs e)
{
Session["MsgBox1"] = TextBox12.Text;
Session["MsgBox2"] = TextBox13.Text;
Session["MsgBox3"] = lblUsa.Text;
Session["MsgBox4"] = lblUk.Text;
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[7] {
new DataColumn("Id"), new DataColumn("name"), new DataColumn("civilid"), new DataColumn("jop"), new DataColumn("markazel3mal"), new DataColumn("OPsec"), new DataColumn("OPusers")});
foreach (GridViewRow row in GridView1.Rows)
{
if ((row.FindControl("CheckBox1") as CheckBox).Checked)
{
string id = row.Cells[1].Text;
string name = (row.FindControl("lblidnamev") as Label).Text.Trim();
string civilid = (row.FindControl("lblidcivilv") as Label).Text.Trim();
string jop = (row.FindControl("lbljop") as Label).Text.Trim();
string markazel3mal = (row.FindControl("lblel3malv") as Label).Text.Trim();
string OPusers = row.Cells[6].Text;
string OPsec = row.Cells[7].Text;
dt.Rows.Add(id, name, civilid, jop, markazel3mal, OPsec, OPusers);
Session["GridViewRow"] = dt;
string url = "/Admin/WebForm4report.aspx";
string s = "window.open('" + url + "', 'popup_window', 'width=800,height=950,left=100,top=100,resizable=yes');";
ClientScript.RegisterStartupScript(this.GetType(), "script", s, true);
}
}
}