There is a Execllent way of searching the UItraWinGrid columns which is given in the Followings Knowledege base article
http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=8077
but is it possible to use a textbox on the form, type in the textbox and get the columns data from which ever column selected.
Here For Example i have entered value in textbox it should select the respective row and highlight it and make it the first row of the Grid,OR is there any feature of UltraWinGrid in which i can bind other control like textbox and Search the UltrawinGrid cells
Hi,
There are a couple of ways you could do this.
One way would be to modify the code in the KB Article. The article uses a buffer to keep track of the string as you type it, but you could just as easily pass in a string from a TextBox in the TextChanged event.
The code that search the grid is really not complicated at all, it just loops through the cells to find one that matches the text you want.
Another option might be to use RowFiltering. By default, the filtering funtionality hides the rows that are filtered out, but it doesn't have to. The RowFilterAction property on the Override object gives you the ability to apply an appearance to the row instead of hiding them. You would then use the FilteredInRowAppearance to decide what the rows that meet the filter criteria look like.
This won't scroll the row in to view, though - it can't since there can theoretically be more than one row.
I have not used the class file instead have done this as u suggested
Private Sub txtSearch_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtSearch.TextChanged
Dim fldCol, tblname As String fldCol = "VstDestination"tblname = "visit"
If txtSearch.Text = "" Then 'Test if the textbox is null, then reset the grid. Me.VisitTableAdapter.Fill(Me.DataSet2.Visit) Else 'Dim dtview As DataViewdtview = New DataView(DataSet2.Tables(tblname)) dtview.RowFilter = fldCol & " like '" & txtSearch.Text & "*'"UltraGrid1.DataSource = dtview End If End Sub
''incase any one needs this in future, happy to help !!!
You can't have two columns with the same key. But you can change the display by setting the Header.Text:
if (false == band.Columns.Exists("String 1 Display")) { UltraGridColumn string1Display = band.Columns.Insert(band.Columns["String 1"].Header.VisiblePosition, "String 1 Display"); string1Display.Style = Infragistics.Win.UltraWinGrid.ColumnStyle.FormattedText; string1Display.Header.Text = band.Columns["String 1"].Header.Text; }
i need unbounded column name same as bounded column name. is it possible? how?
Adding the new column and hiding the existing one is pretty easy. I would use the InitializeLayout event for this.You simply set the Hidden property on the 'real' column and add a column using the Add method on the band.Columns collection.Or better yet, use the Insert method, so it's in the same position.
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { UltraGridLayout layout = e.Layout; UltraGridBand band = layout.Bands[0]; UltraGridOverride ov = layout.Override; if (false == band.Columns.Exists("String 1 Display")) { UltraGridColumn string1Display = band.Columns.Insert(band.Columns["String 1"].Header.VisiblePosition, "String 1 Display"); string1Display.Style = Infragistics.Win.UltraWinGrid.ColumnStyle.FormattedText; } band.Columns["String 1"].Hidden = true; }
You would use the InitializeRow event to populate the unbound column with the text from the 'real' column.
private void ultraGrid1_InitializeRow(object sender, InitializeRowEventArgs e) { if (false == e.ReInitialize) { if (e.Row.Cells.Exists("String 1 Display")) { e.Row.Cells["String 1 Display"].Value = e.Row.Cells["String 1"]; } } }
The difficult part of this is that the displayed column has to be a string and you will need to handle translating the string in the displayed column into whatever value of whatever data type is in the 'real' column. This only applies if the column is editable, of course. If it's read-only, then it's much easier and you don't have to worry about that.
Another difficulty is that you have to do this for every column that the user can search on.
Can u give me some clue for coding part, how to create new unbound column and use it in existing grid and how to hide existing column?
If you want to filter the grid without hiding the filtered-out rows, then this is very easy. All you have to do is set the RowFilterAction property on the Override. There are several options, one of which is to apply an appearance instead of hiding the rows.
This applies an appearance to the entire row, though. It doesn't highlight just the matching text. There's no functionality in the grid for that.
You could implement this yourself, but it would be a bit tricky. You cannot highlight part of a word in a normal grid cell. You would have to have a cell that is using the UltraFormattedTextEditor (or UltraFormattedLinkLabel) as it's editor and you would have to change the Value of the cell in order to get the formatted text with certain parts highlighted. This means changing the Value of the cell itself, so you probably would not want to use the "real" cell, but instead create an unbound column which mirrors the actual cell value and keep the real column and it's value hidden.