sum Checklist Grid view To Textbox แบบขันบันได Format ไม่ได้รบกวน Convert ช่วยหน่อยครับ
protected void chk_CheckedChanged(object sender, EventArgs e)//Gridview to textbox
{
double sum = 0;
int rowind = ((GridViewRow)(sender as Control).NamingContainer).RowIndex;
CheckBox cb = (CheckBox)GridView1.Rows[rowind].FindControl("chk");
for (int i = 0; i < GridView1.Rows.Count; i++)
{
}
if (cb.Checked==true)
{
Tank.Text +=GridView1.Rows[rowind].Cells[9].Text+",";
// Tank.Text = GridView1.Rows[rowind].Cells[9].Text; แบบไป single
double amount = GridView1.Rows[rowind].Cells[3].Text.Trim() != null && GridView1.Rows[rowind].Cells[3].Text.Length > 0 ? Convert.ToDouble(GridView1.Rows[rowind].Cells[3].Text.Trim()) : 0;
sum = amount;
issueqty.Text +=sum.ToString(); //ตัวนี้ sum แบบขั้นบรรได
}
Tag : .NET, Ms SQL Server 2008, Ms SQL Server 2016, Web (ASP.NET), VB.NET, C#