BBS ... DevExpress and Custom Fields


Author
Message
Charles Thomas Blankenship...
Charles Thomas Blankenship
StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)
Group: Awaiting Activation
Posts: 172, Visits: 12K
Currently I'm using a DevExpress grid with the Business Binding Source and it is working swimmingly ... except for one thing.

 

I can only use the actual fields defined in the table to bind to the grid.  I was hoping to be able to create a custom property and select that as the binding field for the column in the grid but that doesn't work.  Here is an illustration:

 

I have a table named Lead and that table is loosely associated with another table named DialRecalls.  I then created a stored procedure and linked these two tables together like so:

 SELECT lea_id,
     lea_FirstName,
     lea_LastName,
     lea_SortName,
     lea_Address,
     lea_City,
     lea_ST,
     lea_ZipCode,
     lea_Phone,
     lea_Phone2,
     lea_SourceID,
     SPACE(50)    AS lea_Source,
     lea_RegionID,
     SPACE(10)    AS lea_Region,
     lea_TelemarketerID,
     SPACE(3)     AS lea_TelemarketerName,
     dir_UserID   AS lea_RecallUserID,
     SPACE(3)     AS lea_RecallUserName,
     dir_RecallOn AS lea_RecallOn
   FROM Lead INNER JOIN DialRecalls ON lea_id = dir_lea_id
  WHERE lea_Status = 'L' AND
     dir_Active = 1   AND
    (dir_RecallOn >= @DateFrom AND dir_RecallOn <= @DateTo)     AND
     dir_UserID =     COALESCE(@dir_UserID, dir_UserID)         AND
     lea_ST      LIKE COALESCE(@lea_ST, lea_ST)           + '%' AND
     lea_City    LIKE COALESCE(@lea_City, lea_City)       + '%' AND
     lea_ZipCode LIKE COALESCE(@lea_ZipCode, lea_ZipCode) + '%' AND
     lea_Phone   LIKE COALESCE(@lea_Phone, lea_Phone)     + '%' AND
     lea_SourceID IN (SELECT cos_ID FROM @SourceIDs) AND
     lea_RegionID IN (SELECT cor_ID
                        FROM Contact_Regions
        WHERE cor_Region IN (SELECT cor_Region
                               FROM @Regions))
     ORDER BY dir_RecallOn 


I then used that stored procedure in the FillByStoredProcedure method and populated the business object with the addition fields that I needed to display (performed using the AS function in SQL) ... as you can see one of those fields is lea_RecallOn which actually came from the DialRecall.dir_RecallOn field. 

 

Next, I created a custom property on the business object like so

        [Browsable(false),
         BusinessFieldDisplayInEditor(),
         Description("DialRecalls.dir_RecallOn"),
         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public DateTime lea_RecallOn
        {
            get
            {
                return (DateTime)this.CurrentRow["lea_RecallOn"];
            }


            set
            {
                this.CurrentRow["lea_RecallOn"] = value;
            }


        }

And finally, I went into the grid designer, created a new column, and bound it to the "lea_RecallOn" field.  The problem is that the grid does not recognize any field that is not part of the strong typed data table created with the BO Mapper.

So, is there anyway to create a property that the grid can see without created a fake property in the DDT and building with the BO Mapper?  

I did get around this by creating a lea_RecallOn column in the datatable and running the above stored procedure ... the grid then picked up the date which originated in the DialRecall table.  I then excluded the field from the Insert and Update operations using the business object properties.

Any recommendations?

 

C. T. 

Charles T. Blankenship
Senior Consultant
Novant Consulting, Inc.
704.975.7152
http://www.novantconsulting.com
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search