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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. MappingName property

MappingName property

Scheduled Pinned Locked Moved C#
cssquestion
2 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.
  • Q Offline
    Q Offline
    qur
    wrote on last edited by
    #1

    I am trying to map my ArrayList of type CRelation to data grid. CRelation class has two properties Child and Parent, both are of type CTable public class CRelation { public CRelation() { // // TODO: Add constructor logic here // } private CTable m_oPrntTbl; public CTable Parent { set {m_oPrntTbl=value;} get{return m_oPrntTbl;} } private CTable m_oChldTbl; public CTable Child { set {m_oChldTbl=value;} get{return m_oChldTbl;} } } public class CTable { public CTable() { // // TODO: Add constructor logic here // } private string m_szName; public string Name { set{m_szName = value;} get{return m_szName;} } } Now i want to map the grid column to Name property of the Child I am using following code to map the property DataGridTextBoxColumn dgcCol = new DataGridTextBoxColumn(); dgcCol.MappingName = "Child.Name"; Code above does not work. Am i doing something wrong here? Thanks

    H 1 Reply Last reply
    0
    • Q qur

      I am trying to map my ArrayList of type CRelation to data grid. CRelation class has two properties Child and Parent, both are of type CTable public class CRelation { public CRelation() { // // TODO: Add constructor logic here // } private CTable m_oPrntTbl; public CTable Parent { set {m_oPrntTbl=value;} get{return m_oPrntTbl;} } private CTable m_oChldTbl; public CTable Child { set {m_oChldTbl=value;} get{return m_oChldTbl;} } } public class CTable { public CTable() { // // TODO: Add constructor logic here // } private string m_szName; public string Name { set{m_szName = value;} get{return m_szName;} } } Now i want to map the grid column to Name property of the Child I am using following code to map the property DataGridTextBoxColumn dgcCol = new DataGridTextBoxColumn(); dgcCol.MappingName = "Child.Name"; Code above does not work. Am i doing something wrong here? Thanks

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      First of all, don't prefix your classes with "C". This is an obsolete naming convention in the .NET Framework and all other CLI implementations. It's important to remain consistent with the .NET Framework because it is a RAD environment (Rapid Application Development). Have any of the classes you've used in the .NET Framework Class Library started with "C" (sans classes like CollectionBase or Control)? You won't find a single one. Read Naming Guidelines[^] for more information. Second, you really should read about the DataGridTableStyle.MappingName property. See http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemWindowsFormsDataGridTableStyleClassTopic.asp[^]. In it, it states that the DataGridTableStyle.MappingName must be set to the class name that the ArrayList - or just a simple array - contains. Your DataGridColumnStyle-derivatives then just contain the property name like Name. The documentation above gives an example using a simple array, but an ArrayList works the same so long as you contain only one type (more than one type causes the first type to be used and any other types will not be bound). This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles] [My Blog]

      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