Hi Everyone,
I would like to know whether we can display e,g, Full Name , thats is " [first_name] + " "+ [surname]" as the display text?
I have set the combo's DataSource and DataMember as the [first_name]. But I need to display first name and surname as the Full name for the combo values.
e.g.
Ann Smith
David Brown
Mary Cornell
ultraGridColumn.Formula = "[surname] & \", \" & [first_name]";
Any suggestions?? Urgent!
Thanks in Advance.
NW
Hi,
What you can do is add an unbound column to your UltraCombo. I would recommend using the InitializeLayout for this.
You can then apply a formula to this column like you have above. Or, you could use the InitializeRow event to populate this unbound column with whatever text you want. Then you just set the DisplayMember to the unbound column.
Thanks Mike! Works wonderfully!!
HI Mike!
Theres one more problem. When the form loads, i want to set a particular value selected in the UltraCombo . e.g. John Smith, wihch is retrive from the DataTable,.When I read the other posts that can be done setting the Value property.
I have set my ValueMember as "oper_name", which is a string:
this.ucMsgSentTo.ValueMember = "oper_name";
this.ucMsgSentTo.DataSource = this.operatorBindingSource;
this.ucMsgSentTo.DropDownStyle =DropDownList
And also set the Display Member:
{
}
Then i have set the oper_name string value, which is similar to "reciepeint" value, to ucMsgSentTo.Value e.g. "johns"
ucMsgSentTo.Value = _row["recipient"].ToString();
Now when we set like this, it should show the "John Smith" on the combo wehn loading, BUT IT IS NOT!!! it shows blank in the Combo Text, but when i select the drop down button, it shows the "John Smith" on top of the list. I want to show the "John Smith" when loading.
Whats wrong with this coding? Please help ..its urgent...
Thanks alot.
I'm not sure if this is the issue, but one thing I notice here is that you are setting the DisplayMember in the InitializeRow event. This is probably not a good idea and it's certainly not very efficient. You only need to set this property once in the InitializeLayout. Setting it in InitializeRow sets it over and over again for no reason.
Also, you kinda lost me at the end of your description there. If the ValueMember of the combo is using the "oper_nam" field, then why are you saetting the Value to a recipient value? The Value of the combo has to match up to an item on the list exactly. So why not use the "oper_name"?
HI Mike,
Thanks alot for your reply.
Well what I meant by recipient is, it returns the same values as the oper_name. e.g. recipient = oper_name = "johns".
So even if I hardcode the value as ucMsgSentTo.Value = "johns" (Since ucMsgSentTo.ValueMamber = "oper_name") it wont show the "John Smith" value when it is loaded. Combo value will be set to null. And it will show the blank text when loaded. I tried to set ucMsgSentTo.Value = "John Smith", that doesnt work either :'((
==========================================================================================================
Here are the Column properties for your reference:
Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn25 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("full_name", 0);
ultraGridColumn25.Formula = "[first_name] & \" \" & [surname]";
ultraGridColumn25.Header.VisiblePosition = 24;
ultraGridColumn1,--------------,----------------, ultraGridColumn25});
Combo Properties
this.ucMsgSentTo.DisplayStyle = Infragistics.Win.EmbeddableElementDisplayStyle.Default;
this.ucMsgSentTo.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.ucMsgSentTo.Name = "ucMsgSentTo";
this.ucMsgSentTo.Size = new System.Drawing.Size(190, 22);
this.ucMsgSentTo.InitializeLayout += new Infragistics.Win.UltraWinGrid.InitializeLayoutEventHandler(this.ucMsgSentTo_InitializeLayout);
I did what you told about having the code in InitializeLayout as well. Please let me know what would be the problem with this coding.
Regards,
I really don't know why this is not working. The only reason that I can think of why this would not work is if you are setting the Value and / or text before the control has populated. If that's not the case, then I am not sure.
You should try duplicating this in a small sample project and Submit an incident to Infragistics Developer Support.
This is a Standalone UltraCombo and im NOT using the UltraGrid. The ultraGridBand1 is automatically added when added a Unbound Column as "Full Name" (which is shown above) and Hide all the other columns and show only Full Name. The full names are loadded nicely to the comobo. BUT only problem is it does not set the VALUE ("John Smith") i wanted when first loading up!!!!!
The following code shows hows it addded.
Infragistics.Win.UltraWinGrid.UltraGridBand ultraGridBand1 = new Infragistics.Win.UltraWinGrid.UltraGridBand("operator", -1);
ultraGridBand1.ColHeadersVisible = false;
ultraGridColumn1,
ultraGridColumn2,
ultraGridColumn3,
ultraGridColumn4,
ultraGridColumn5,
ultraGridColumn6,
---------,
----------,
ultraGridColumn25}); // <---- this is the Full name column, and all the other columns hidden
ultraGridBand1.UseRowLayout = true;
this.ucMsgSentTo.DisplayLayout.BandsSerializer.Add(ultraGridBand1);
********* Please refer the above reply for the other coding *****************
It makes me crazy even if i set the exact values
ucMsgSentTo.Value = "johns",
ucMsgSentTo.Text = "John Smith",
It sets to BLANK!!!! Please help me . URRRRGENT HELP NEEEDED!!!
Okay, is this a standalone UltraCombo or are you using it in a grid? I thought it was a standalone combo control because you are setting the Value property of the UltraCombo. But if you are using this in a grid, then the Value of the Combo is not used. That would not make sense, since the Combo only has one Value and the grid has multiple cells in the column. If this is in a grid, you need to set the Value of the grid cell, not the UltraCombo.