ID sum payed
1 354 200
1 2345 23435
我有gridview2
来自gridview1
,其中选择的行checkbox
。
我想将值从sum移动到payd,因此payed从sum中获取值,然后sum变为空。请帮助我,我是新手。
谢谢:)
namespace WebApplication5
{
public partial class Presmetuvanje : System.Web.UI.Page
{
public int @UserID;
SqlConnection sqlConn = new SqlConnection(Web.GetConfigValue("proekt1"));
//private DataTable dt;
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection sqlConn = new SqlConnection(Web.GetConfigValue("proekt1"));
if (Web.IsMemberSession)
{
Response.Write("Welcome" + " " + Web.SessionUser.Naziv);
}
}
protected void Button2_Click(object sender, EventArgs e)
{
String Oznacheni = "";
SqlConnection sqlConn = new SqlConnection(Web.GetConfigValue("proekt1"));
CheckBox ch;
foreach (GridViewRow row in GridView1.Rows)
{
ch = (CheckBox)row.FindControl("CheckBox1");
if (ch.Checked == true)
{
String pom = row.Cells[0].Text;
if (Oznacheni.Length > 0) pom = ", " + pom;
Oznacheni += pom;
}
}
if (Oznacheni.Length < 1) Oznacheni = "-1";
SqlDataSource2.SelectCommand = " SELECT * FROM fakturis WHERE fakturaID IN (" + Oznacheni + ")";
SqlDataSource2.DataBind();
GridView2.DataBind();
}
protected void Button1_Click(object sender, EventArgs e)
{
try
{
Web.SessionUser = null;
Web.IsMemberSession = false;
Response.Redirect("Login.aspx");
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
}
protected void Button3_Click(object sender, EventArgs e)
{
int sum = 0;
for (int i = 0; i < GridView2.Rows.Count; i++)
{
sum += int.Parse(GridView2.Rows[i].Cells[7].Text);
}
Label1.Text = "Platenata suma iznesuva "+sum.ToString() +" denari";
}
}
}
在此Button3_Click之后,我想添加新方法,将值从sum添加到payd 然后总和变空了。