DG->GridView problem...
-
I need a guru's advice: I am porting datagrids over to gridviews, and have the following old code:
foreach (DataGridItem dgItem in dgClicks.Items) { CheckBox chkSelected = (CheckBox)dgItem.FindControl("chkSelection"); if (chkSelected != null && chkSelected.Checked) { if (dgClicks.DataKeys[dgItem.DataSetIndex] != System.DBNull.Value) { int nTopupRequestID = (Int32)dgClicks.DataKeys[dgItem.DataSetIndex]; BL.receipts.BlockCapturedTransaction(nTopupRequestID, edBlockReason.Text); } } }
But I can't seem to figure out how to fix the second conditional in what I have written to convert.. I keep getting an operator overload error..foreach (GridViewRow gvRow in gvClicks.Rows) { CheckBox chkSelected = (CheckBox)gvRow.FindControl("chkSelection"); if (chkSelected != null && chkSelected.Checked) { **if (gvClicks.DataKeys[gvRow.DataItemIndex] != System.DBNull.Value)**:confused: { int nTopupRequestID = Convert.ToInt32(gvClicks.DataKeys[gvRow.DataItemIndex]); BL.receipts.BlockCapturedTransaction(nTopupRequestID, edBlockReason.Text); } } }
I'm sure this is an easy fix for some of yu guys.. so what did I do wrong? Is there a better way to approach this with the GridView?? Hoping for someones kind assistance! -Eric Practice sesquipedalianism! ;) **-- modified at 8:27 Friday 24th March, 2006 LETS SHORTEN MY QUESTION.. HOW WOULD YOU WRITE THIS WITH A GRIDVIEW, NOT A DATAGRID??if (dgClicks.DataKeys[dgItem.DataSetIndex] != System.DBNull.Value)
**