2017-08-24 3 views
0

これらの列の中に合計いくつかの列があるグリッドビューがあります。そのうちの1つはチェックボックスです。最後の列の値を取って表示しますあなたがチェックボックスで選択したグリッドに試してみてください)CheckedChanged(ベースコード)をチェックしてみてください。このコードは私の下にありますが、歌や合計ではありません。行う方法を知っていること合計グリッドビューのチェックボックス付きチェックボックス

コード:

Dim Total As Decimal 
    For Each row As GridViewRow In Gvcobranzas.Rows 
     Dim check As CheckBox = DirectCast(row.FindControl("CheckBox1"), CheckBox) 
     If check.Checked = True Then 
      Dim x As Decimal = 0 
      If Decimal.TryParse(row.Cells(2).Text, x) Then 
       Total += CDec(row.Cells(2).Text) 

      End If 
     End If 
    Next 
    TxtMonto.Text = Total 
+0

いくつかの図や表/グリッドを使用して期待した結果を見せてください。これは理解しにくいです(私は英語があなたの母国語ではないことを理解しています) –

答えて

0

LigroのHACER詐欺のjavascript

dejo el codigo

     $(function() { 

        $("input[type=checkbox]").change(function() { 
         //variables to store the total price of selected rows 
         //and to hold the reference to the current checkbox control 
         var totalPrice = 0, ctlPrice; 
         //iterate through all the rows of the gridview 
         $('.Gvcobranzas tr').each(function() { 
          //if the checkbox in that rows is checked, add price to our total proce 
          if ($(this).find('input:checkbox').attr("checked")) { 
           ctlPrice = $(this).find('[id$= Label3]'); 
           //since it is a currency column, we need to remove the $ sign and then convert it 
           //to a number before adding it to the total 
           totalPrice += parseFloat(ctlPrice.text().replace(/[^\d\.]/g, '')); 
          } 
         }); 
         //finally set the total price (rounded to 2 decimals) to the total paragraph control. 
         $('.sum').text("$ " + totalPrice.toFixed(2)); 
        }); 
       }); 
関連する問題