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. DataGrid bounded to a DataTable with composite key.

DataGrid bounded to a DataTable with composite key.

Scheduled Pinned Locked Moved C#
questionhelp
3 Posts 2 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.
  • M Offline
    M Offline
    miah alom
    wrote on last edited by
    #1

    I have a DataTable with composite key bounded to the DataGrid. So when the user inserts some data which violates the constraint, an exception is thrown. What is the right place (event etc) to do any additional custom Validation? Another problem is the the message that DataTable throws is not user friendly? How can I stop it and give a more meaningful message? The message I got is "Error when committing the row to the original data store"

    R 1 Reply Last reply
    0
    • M miah alom

      I have a DataTable with composite key bounded to the DataGrid. So when the user inserts some data which violates the constraint, an exception is thrown. What is the right place (event etc) to do any additional custom Validation? Another problem is the the message that DataTable throws is not user friendly? How can I stop it and give a more meaningful message? The message I got is "Error when committing the row to the original data store"

      R Offline
      R Offline
      rudy net
      wrote on last edited by
      #2

      You can add and event handler for the RowChanging event of your datatable.

      M 1 Reply Last reply
      0
      • R rudy net

        You can add and event handler for the RowChanging event of your datatable.

        M Offline
        M Offline
        miah alom
        wrote on last edited by
        #3

        Thanks a lot for the reply. I tried this before, but I want the DataGrid to do the actual validation but I want to give a custom message. But in case of the solution you have specified, the DataGrid itself shows a MessageBox with a message which is not use friendly.

        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