I have a RadGridView, and a button "Next", which makes the selected row change to the one below when the user clicks on it:
int selectedIndex = this.radgrid.SelectedRows[0].GridViewInfo.CurrentIndex;
//Go to next index
selectedIndex++;
this.radgrid.CurrentRow = radgrid.Rows[selectedIndex];
The problem occurs when the grid is sorted by one column, say a Date column. If one date is expanded and a row is clicked, the CurrentIndex is the index of the row within the selected date. But when I try to set the CurrentRow, it is set to the "overall" index, as if the grid was not sorted.
Any ideas on how to solve this?
Regards, Jill-Connie Lorentsen
Hello,
I have a master form which is the MDI parent and a child form which is the MDI child. I use the following code to open the master form and load in a child form:
Private
Sub MasterForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim clientForm As New ClientForm
With clientForm
.MdiParent =
Me
.MinimizeBox =
False
.MaximizeBox =
False
.WindowState = FormWindowState.Maximized
End With 'clientForm
Dim document As New DocumentWindow("Document 1")
clientForm.Visible =
True
clientForm.Show()
document.AutoScroll =
True
document.Controls.Add(ClientForm)
document.Controls(0).Location =
New Drawing.Point(0, 0)
Me.RadDock1.AddDocument(document)
Me.WindowState = FormWindowState.Maximized
End Sub
I set the autoscroll property of the DocumentWindow to True, so whenever there is a field not visible a scroll bar appears, which works well.
What I can't figure out is how do I wire up code for the mousewheel event or for the KeyDown event to scroll the scrollbar? I was able to successfully do this creating a radform with 2 radpanels and a radvscrollbar. But now that I am using this autoscroll, what do i reference?
Thanks,
DataGrid.DataSource = dt;
then i save some staff in my DB and then i wanted to bound different data table to the same grid using the same command line
DataGrid.DataSource = saveddt;
but i get a null reference exception
Object reference not set to an instance of an object.
at Telerik.WinControls.UI.GridTableBodyElement.editor_Validated(Object sender, EventArgs e)\r\n at Telerik.WinControls.UI.RadCheckBoxEditor.OnValidated(EventArgs args)\r\n at Telerik.WinControls.UI.RadCheckBoxEditor.SaveValue()\r\n at Telerik.WinControls.UI.GridTableBodyElement.ResetActiveEditor(Boolean restoreOriginalValue)\r\n at Telerik.WinControls.UI.GridTableBodyElement.Update(Boolean dataSourceChanged)\r\n at Telerik.WinControls.UI.GridTableElement.Update(Boolean dataSourceChanged)\r\n at Telerik.WinControls.UI.GridViewInfo.UpdateView(Boolean dataSourceChanged)\r\n at Telerik.WinControls.UI.GridViewInfo.UpdateView()\r\n at Telerik.WinControls.UI.GridViewTemplate.Rebind()\r\n at Telerik.WinControls.UI.RadGridView.RefreshColumnsAndRows()\r\n at Telerik.WinControls.UI.GridViewData.InitDataOnly()\r\n at Telerik.WinControls.UI.GridViewData.InitView()\r\n at Telerik.WinControls.UI.GridViewData.SetDataConnection(Object dataSource, String dataMember)\r\n at Telerik.WinControls.UI.RadGridView.DoDataBinding()\r\n at Telerik.WinControls.UI.RadGridView.CallDoDataBinding()\r\n at Telerik.WinControls.UI.GridViewTemplate.set_DataSource(Object value)\r\n at Telerik.WinControls.UI.RadGridView.set_DataSource(Object value)\r\n