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. Visual Basic
  4. Even more fun with @%&$@$%# Datagrids!

Even more fun with @%&$@$%# Datagrids!

Scheduled Pinned Locked Moved Visual Basic
helpdesignquestion
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.
  • R Offline
    R Offline
    raysot777
    wrote on last edited by
    #1

    I have one last line of code to write then this project is complete. I have spent 2 weeks on this "Last Line" .... :-) Trying to read the contents of a datagrid to Excel: This works if the column is simply a bound column: For i = 0 To StatusGrid.Items.Count - 1 worksheet.Cells(i + 2, 1) = StatusGrid.Items(i).Cells(1).Text() Next However, for Template columns, the following SHOULD work, but does not: For i = 0 To StatusGrid.Items.Count - 1 worksheet.Cells(i + 2, 2) = CType(StatusGrid.Items(i).Cells(2).Controls(0), DataBoundLiteralControl).Text() Next I get the following error: Unable to cast object of type 'System.Web.UI.LiteralControl' to type 'System.Web.UI.DataBoundLiteralControl'. I am at my wit's end on this one... Can anyone help?

    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