Hi
1. When got focus DataGridView puts it’s firs row in selected mode (become with blue background), why?
2. Can navigate to any DataGridView row programmatically, even if the column is outside visible area (need to scroll to it)?
Thank you!
Mario
Dear Luca
After Rows.Clear() , i fill the grid manually (as you can see), and after that in other procedure I select the row being edited like this:
Private Shared Function F5F6BC7D501BA43568E1CBAB75BC8836F(InOstrRowID As String) As Boolean
Dim OGridOO As CLib.CUI.CDataGridView = CType(CLib.CUtils.CobjectsRegister.FGet(“{2A3EED9A-3FC6-4503-8A80-11465474B828}”), CLib.CUI.CDataGridView)
Dim ODGRow As Wisej.Web.DataGridViewRow = Nothing
For Each ODGRow In OGridOO.Rows
If ODGRow.Cells(“RowId”).Value.ToString = InOstrRowID Then
ODGRow.Selected = True
Exit For
End If
Next
Return True
End Function
Dear Luca,
This is how I read(rerad) the grid:
‘GRIDREAD
Dim OGridOO As CLib.CUI.CDataGridView = CType(CLib.CUtils.CobjectsRegister.FGet(“{2A3EED9A-3FC6-4503-8A80-11465474B828}”), CLib.CUI.CDataGridView)
Dim OSTRSQL As String = “SELECT RowID, DomainID, UserDomainID, ServerDateRegistered, Nazvanie, EIK, EIKDDS, MANAGER_DLUJNOST, MANAGER_NAZVANIE, HEADAccountantName, MOLName, OSOName, PHONE, FAX, EMAIL, ADDRESS_COUNTRY, ADDRESS_REGION, ADDRESS_NASELENOMIASTO_NAME, ADDRESS_NASELENOMIASTO_POSTENSKIKOD, ADDRESS_STREET_NAME, ADDRESS_STREET_NUMBER, ADDRESS_BLOK_NUMBER, ADDRESS_BLOK_VHOD, ADDRESS_BLOK_ETAJ, ADDRESS_BLOK_APARTMENTNUMBER FROM TOtchetniObekti WHERE DomainID='” & OStrDomainID & “‘ ORDER BY UPPER(Nazvanie)”
Dim OSqlDataReader As System.Data.SqlClient.SqlDataReader = Nothing
OSqlDataReader = CType(Wisej.Web.Application.OpenPages(0), Page1).FSQLServerMainDataBaseContactQuery(OSTRSQL)
Dim OdataTableResult As New System.Data.DataTable
If OSqlDataReader.HasRows = True Then
OdataTableResult.Load(OSqlDataReader)
OSqlDataReader.Close()
Else
OGridOO.Rows.Clear()
OSqlDataReader.Close()
Return False
End If
Dim ODataRow As System.Data.DataRow = Nothing
Dim ODGRow As Wisej.Web.DataGridViewRow = Nothing
OGridOO.Rows.Clear()
For Each ODataRow In OdataTableResult.Rows
OGridOO.Rows.Add()
ODGRow = OGridOO.Rows.GetLastRow
For i = 0 To ODGRow.CellCount – 1
ODGRow.Cells(i).Value = ODataRow.Item(OGridOO.Columns(ODGRow.Cells(i).ColumnIndex).Name)
Next
Next
I’m trying to reproduce. How do you reread the grid content, by setting the DataSource property?
The grid doesn’t decide what to select, it sets the first visible cell as the current cell when there is no current cell – which is the same behavior you see in WinForms’s DataGridView.
Thank you!
As for one (1) it is not exactly the way for me. My scenario: I select row – open custom editing form – do some editing – close editing form – reread grid content – navigate to row being selected and edited. And immediately after grid gets focus it sets the first row as selected (deselecting my being edited row). Why?
If i handle event of ENTER for the grid and select my row again in the best case I will got flickering of rows being selected and deselected. Grid should not decide by itself which row to be selected.
I need my being edited row to stay selected. Not just to clear all selections.
Best regards!
Mario
Hi,
Best regards
Frank
Please login first to submit.