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
275
Fill UltraCombo with only DisplayValue and NOT ValueMember
posted

I want to "fill" an ultracombo so a grid can be populated based on the ValueMember that is choosen from. Here's the following code.

public void FillCombo(){

conn = new SqlConnection(MSSQL);
cmd = new SqlCommand();
cmd.Connection = conn;
conn.Open();
cmd.CommandType = CommandType.Text;
cmd.CommandText = @"SELECT RTRIM(NOMBRE_ESQUEMA) as NOMBRE_ESQUEMA, ESQUEMA FROM dbo.COMISIONES_ESQUEMAS;";

MyReader = cmd.ExecuteReader();
DataTable dt = new DataTable();

dt.Load(MyReader);

if (dt.Rows.Count > 0){
this.eucEsquema.DataSource = dt;
this.eucEsquema.DisplayMember = "NOMBRE_ESQUEMA";
this.eucEsquema.ValueMember = "ESQUEMA";
}


conn.Close();
cmd.Dispose();

}

The problem here is that whenever I click the ultracombo box, both DisplayMember and ValueMember appears and I only want the user to see the DisplayMember. I don't want them to actually see the ValueMember cause if they do, maybe they'll get confused.

NOTE: I want the ValueMember to be available, but not displayed on the ultracombo box

Is there a way to achieve this?

Thanks

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

    Hi William,

    Yes, this is very easy to do. Just hide the column.


            private void ultraCombo1_InitializeLayout(object sender, InitializeLayoutEventArgs e)
            {
                var layout = e.Layout;
                var band = e.Layout.Bands[0];

                band.Columns["ESQUEMA"].Hidden = true;
            }

Children