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. .NET (Core and Framework)
  4. Databinding Errors

Databinding Errors

Scheduled Pinned Locked Moved .NET (Core and Framework)
comdesignsaleshelpquestion
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.
  • D Offline
    D Offline
    DaAmazing1
    wrote on last edited by
    #1

    Little Background: I have a customer class with 2 properties (FirstName and LastName). On the set of the FirstName property I have code that will not allow the name to be longer than 35 characters, if it is the property throws an exception. This works fine... Here's the problem: I have a textbox that I databind to the Customer Firstname property. This displays correctly and binds correctly. But when I enter a value that causes the Customer FirstName property to throw and exception I can't catch the exception and display a message to the user. Instead the textbox will not let me leave until it is fixed. Is there a way to catch the exception that the underlying Class throws? Mediajuggle - Design House Quality At Freelance Prices http://www.mediajuggle.com

    J 1 Reply Last reply
    0
    • D DaAmazing1

      Little Background: I have a customer class with 2 properties (FirstName and LastName). On the set of the FirstName property I have code that will not allow the name to be longer than 35 characters, if it is the property throws an exception. This works fine... Here's the problem: I have a textbox that I databind to the Customer Firstname property. This displays correctly and binds correctly. But when I enter a value that causes the Customer FirstName property to throw and exception I can't catch the exception and display a message to the user. Instead the textbox will not let me leave until it is fixed. Is there a way to catch the exception that the underlying Class throws? Mediajuggle - Design House Quality At Freelance Prices http://www.mediajuggle.com

      J Offline
      J Offline
      Jon Fitzgerald
      wrote on last edited by
      #2

      I have had this problem before. I don't remember how I solved it...but, if you are still having trouble with this in a couple of days, then email me and I will dig through my old files. Sincerely, Jon Fitzgerald jonfitzgerald2@hotmail.com

      D 1 Reply Last reply
      0
      • J Jon Fitzgerald

        I have had this problem before. I don't remember how I solved it...but, if you are still having trouble with this in a couple of days, then email me and I will dig through my old files. Sincerely, Jon Fitzgerald jonfitzgerald2@hotmail.com

        D Offline
        D Offline
        DaAmazing1
        wrote on last edited by
        #3

        The way I solved the problem was by overriding the OnValidating method of the textbox. It works but it is not the most elegant solution, does this sound familar? Mediajuggle - Design House Quality At Freelance Prices http://www.mediajuggle.com

        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