Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. DG->GridView problem...

DG->GridView problem...

Scheduled Pinned Locked Moved C#
helpquestiontutorial
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    E L Golpe
    wrote on last edited by
    #1

    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)

    **

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups