Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
240
Working with an unbound column
posted

Greetings,

     I'm pretty new to the utlragrid control so bear with me.  Using VB .Net I've added a grid to a form that saves a GroupKey and a CompanyID to a table in SQL Server.   This portion I have working pretty well but then I was given a requirement to display the full company name on the grid as well which will not be saved to the database.  

     I figured an unbound column would be the best approach to this so I added one to the grid and added code to the AfterCellUpdate procedure to populate the company name column when a company id is updated or entered.   Again this worked pretty well as long as I tabbed off the company id cell (another question I have but will post separately).  

     The problem I run into is when I open the form and retrieve records.  The companyID displays as it should but the value for the Company Name column does not.   I tried adding code to the cell change event to see once the companyID cell was populated if it would populate the company name column.  However, this did not work.

    So my question is what is the best technique to ensure the company name column populates based on the value set in the company id column.

Thanks

Parents
No Data
Reply
  • 469350
    Offline posted

    The unbound column approach will work, but that's doing things the hard way.

    A much easier way to do this would be to provide a dropdown list in the existing bound column.

    I assume that you have a table of company IDs and company names. What you do is load that data and bind it to either a BindableValueList or an UltraDropDown control. Either way, you set the ValueMember and DisplayMember on the list to the CompanyID and CompanyName fields respectively.

    Then you set the ValueList property on the grid column to the ValueList/UltraDropDown control. And that's it. The value list will automatically translate the values into display text in the grid, but still save the IDs to the underlying data source.

Children