如何在数据网格视图中获取选中复选框的值,并在数据库mysql中插入选定的行。
我有列名为cloth_id,cloth_desc quantity cloth_desc price如果选中了行中的复选框,那么数量和价格将乘以得到要支付的总金额。提前感谢:)这段代码只适用于一行。当多行被选中时,帮助我查询。谢谢:)
If e.RowIndex >= 0 Then
Dim row As DataGridViewRow
Dim amount, qty, prod As Double
row = Me.DataGridView1.Rows(e.RowIndex)
amount = row.Cells("Price").Value.ToString
qty = row.Cells("Qty").Value.ToString
prod = amount * qty
kg.Text = prod
End If发布于 2014-10-01 14:28:23
请尝试此编码
Dim checkBox1 As CheckBoxlist = GridView1.Rows(e.RowIndex) .FindControl("Checkbox1")
if checkbox1.checked=true then
For Each li As ListItem In checkBox1 .Items
If e.RowIndex >= 0 Then
Dim row As DataGridViewRow
Dim amount, qty, prod As Double
row = Me.DataGridView1.Rows(e.RowIndex)
amount = row.Cells("Price").Value.ToString
qty = row.Cells("Qty").Value.ToString
prod = amount * qty
kg.Text = prod
next
End If
else
End Ifhttps://stackoverflow.com/questions/26134322
复制相似问题