Hi ,
I have attached a ultradropdown to ultragird as valueslist in a column.
my first row of the dropdwon text is "NONE", when i select the NONE row i want to replace the NONE witht the string.empty. but it is not allowing me to change the text.
When i change the text in the grid ultradropdonw events are not fireing.
i have handed the same for the ultracombo it is working fine.
protected override void OnAfterCloseUp(EventArgs e) { base.OnAfterCloseUp(e);
if (this.Text == " {None}") { this.Value = null; this.Text = string.Empty;
} }
Please help me in this regard.
Thanks
Subbu.
I don't have a sample of this, specifically. But if you do a search on these forums for "DataFilter", I'm sure there is some sample code that will point you in the right direction.
Basically, the DataFilter would just have to handle the EditorToDisplay conversion and convert "{None}" to an empty string. Then reverse the process in the DisplayToEditor conversion.
Could you please help me with some sample code.
I believe I understood the problem the first time. But what you are trying to do here is not a common scenario. The grid doesn't have any way to know that you want to display an empty string instead of the text on the list.
If the user selects an item from the list and that item's text is "{None}", then that is what will show up in the grid. There are a number of ways you might achieve this, but none of them are simple or easy and it depends on a number of factors, such as the Style of the column.
If the column style is DropDownList and the user cannot type into it, then the easiest way to handle this would be to use a CreationFilter and trap for the creation of the TextUIElement in the cell and change it's text.
Another option, as I said above, would be to use a DataFilter.
Regarding the OnAfterCloseUp, my guess is that the event does is not used and you need to use an event on the grid.
Hi Mike,
Thanks for your replay. Filters will not server my problem.
You didn’t understand my problem.
Here is my code
Dim bddValueList As New UltraDropDown
Private Sub grdSearchResults_InitializeLayout(ByVal sender As Object, _
ByVal e As InitializeLayoutEventArgs) _
Handles grdSearchResults.InitializeLayout
bddValueList= generateDropDown () ‘ generateDropDown () function will return UltraDropDown(wrapper class )
e.Layout.Bands(0).Columns(1).ValueList = bddValueList
End Sub
With this my grid will be ready with my UltraDropDown as column.
Now I have “{none}” as an option in my Dropdown. When I select “{none}” form my Dropdown it has replace with string. Empty (my business requirement).
Option one: -
How can I achieve this?
Option two:-
I have overridden the events of DropDown (wrapper on top of UltraDropDown). This event are not firing when I change/close/leave the dropdown in the grid.
If, I am able to fire this events my problem will be solved. But these events are not firing when the dropdown is in the grid.
protected override void OnAfterCloseUp(Infragistics.Win.UltraWinGrid.DropDownEventArgs e)
{
base.OnAfterCloseUp(e);
if (this.Text == " {None}")
this.Text = string.Empty;
}
protected override void OnAfterDropDown(Infragistics.Win.UltraWinGrid.DropDownEventArgs e)
base.OnAfterDropDown(e);
if ( (this.Text == " {None}" || this.Text == string.Empty))
if (this.Rows.Count > 0)
this.ActiveRow = this.Rows[0];
protected override void OnLeave(EventArgs e)
base.OnLeave(e);
Please help me with code ASAP.
Hi Subbu,
I'm not sure I follow you. But my guess is that the Style of the column is set to DropDownList and therefore the cell will not accept a value that is not on the list.
Also, changing the value of the cell in OnAfterCloseUp might be too early. Perhaps this code you have here is working, but then the control is overwriting the text with some other value.
I don't think you will be able to do this by setting the Value. A better way to do this might be to use a DataFilter so that you could translate the Editor value of the control "{None}" into a display value of an empty string, and vice versa.