Dim ds_typ_czujnika As New DataTable
ds_typ_czujnika.Columns.Add(
"id")
ds_typ_czujnika.Columns.Add(
"naz")
Dim myCommand As SqlCommand
Dim dr As SqlDataReader
conn_dodatkowe.Open()
myCommand =
New SqlCommand("select id_typ as id, nazwa as naz from tab_urzadzenia_typy where akt = 'True' order by nazwa", conn_dodatkowe)
myCommand.CommandType = CommandType.Text
dr = myCommand.ExecuteReader()
While dr.Read()
ds_typ_czujnika.Rows.Add(dr(0), dr(1))
End While
dr.Close()
conn_dodatkowe.Close()
Dim k0 As New GridViewLookUpColumn()
k0.FieldName =
"typ_czujnika"
k0.FieldAlias =
"typ_czujnika"
k0.UniqueName =
"typ_czujnika"
k0.HeaderText = lng.zwroc_napis_z_nazwy_elementu(
"typ_czujnika")
k0.DataSource = ds_typ_czujnika
k0.DisplayMember =
"naz"
k0.ValueMember =
"id"
Me.gv_ustawienia.Columns.Add(k0)
Now, I have drag&drop event and I can read the values of columns, including a pre-selected text from k0. Is there any way to read the value id (k0.value member) assigned to that text directly from this row ?
Thank's a lot for help.
Dim
p As System.Drawing.Point = gv_ustawienia.PointToClient(New System.Drawing.Point(e.X, e.Y))
Dim element As RadElement = gv_ustawienia.ElementTree.GetElementAtPoint(p)
Dim cell As GridCellElement = TryCast(element, GridCellElement)
Dim row As GridRowElement = Nothing
If cell IsNot Nothing And Not (TypeOf (element) Is GridHeaderCellElement) Then
row = cell.RowElement
....
Telerik.WinControls.UI.
ColumnGroupsViewDefinition columnGroupsDefinition = this.radGridView.ViewDefinition as Telerik.WinControls.UI.ColumnGroupsViewDefinition;
columnGroupsDefinition.ColumnGroups.Clear();
if (this.radGridView.Columns.Count > 0) this.radGridView.Columns.Clear();
if(this.radGridView.Rows.Count > 0) this.radGridView.Rows.Clear();
An unhandled exception has occured with the following details | |
Message | Object reference not set to an instance of an object. |
Stack Trace |
at Telerik.WinControls.UI.RadGridView.EndEditCore(Boolean cancel, Boolean finishEditingOperation) at Telerik.WinControls.UI.RadGridView.EndEdit() at Telerik.WinControls.UI.RadGridView.ValidatePositionChange(GridViewRowInfo rowInfo, GridViewColumn column) at Telerik.WinControls.UI.BaseGridBehavior.OnMouseDownLeft(MouseEventArgs e) at Telerik.WinControls.UI.BaseGridBehavior.OnMouseDown(MouseEventArgs e) at Telerik.WinControls.UI.RadGridView.OnMouseDown(MouseEventArgs e) at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at Telerik.WinControls.RadControl.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) |
Additional Data | |
TicketNumber | 21c900c6-0ab5-4f64-bc53-839a3a783e45 |
When an empty RadGridView is shown the RadGridView shows the message "no data to display".
When i set a RadGridLocalizationProvider then it should show the translated message from the NoDataText RadGridStringId, but it shows the message "no data to display". This happens in the initialisation of the RadGridView.
When i clear the columns of the RadGridView then the correct translated message is shown.
Regards,
Ramius