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
765
How to associate UltraCombo with UltraGridColumn and retrieve Value, not display text?
posted

I have an Ultragrid that contains a column called "Current Location".  This column's EditorControl property is set to my UltraCombo, called "comboSiteLkup".  The comboSiteLkup ultracombo has DisplayMember = site code and ValueMember = site id.  I am also using a RowEditTemplate with this grid.  The Current Location field (type: UltraGridCellProxy) on the RowEditTemplate has a name prefixed with "ugcp" (called "ugcpsite_id_current").  When the RowEditTemplate opens, I can see the ultracombo associated with my Current Location field (good).  My problem is - after a user selects a value from the ultracombo, how do I retrieve the VALUE associated with what was selected, not the DISPLAYVALUE?  Here's a code snippet of what I'm trying to do:

//This is the code-behind the OK button on the RowEditTemplate
private
void btnTemplateOk1_Click(object sender, EventArgs e)
{
        //Using the .Text property here is ok.  I want to evaluate the displayvalue.       
         if (ugcpsite_id_current.Text == "CHK" && ugcpCHECKED_OUT_TO2.Text == "")
         {
             MessageBox.Show("You must select a person in Checked out to:");
             ugcpCHECKED_OUT_TO2.Focus();
          }
         else
         {
              //Add BOX
              if (this.ultraGridRowEditTemplate2.Row.IsAddRow)
              {
                 // I need the ValueMember here to insert the "site id" into the Box record.  I don't know how to retrieve this in code?
                   bOXTableAdapter.InsertBox(ugcpBOX_TYPE.Text, "VERIFIED", ugcpsite_id_current.Text, ugcpSITE_ID_HOME.Text,
                                      ugcpJD_BOX_ID.Text, ugcpDESCRIPTION1.Text, ugcpVENDOR_BOX_ID.Text, ugcpCHECKED_OUT_TO2.Text);
                   this.rMSDataSet.BOX.AcceptChanges();
                   rMSDataSet.BOX_LKUP.Rows.Add(ultraGrid1.ActiveRow);
              }

In the code-behind, I've tried to use syntax like "ugcpsite_id_current.value", but value is not found by Intellisense (not right context).

Help?

Parents
  • 45049
    posted

    WinCombo does have a Value property, and this is likely what you are looking for.

    Depending on the method signature of your InsertBox() method, you may need to cast the combo's Value property to the appropriate class, since Value returns an object.

Reply Children