I am sure this is a setting somewhere, but I can't find it for my life. In some cases, we have where Grid columns exceed the width of the visible grid. When that happens, the grid data is centered in the visible area. How can we prevent that?
I figured out my issue. The Result set to the DataSource is based on an inherited class. This means I am changing the sort order of the columns, but the Scroll Bar seems to think that the column that has been moved from ordinal position 0 to 8 is still in position 0, setting the scroll bar to look like it does above. I might have a workaround for this. So, the question is, did I find a bug?
I am not sure if I understand you correctly, but it seems that the horizontal scrollbar comes in the middle on your side when you have more columns in grid exceeding the visual area. I suppose there is something different in your setup that causes this because by default the scrollbar should remain in the begging at the most left area showing the firstly added columns. This behavior can be observed in our grid demos as well. Below you can see the result on my end after I added 10 column in a grid in my test project:
Reading your second reply in this thread, I understand that you managed to get the scrollbar in desired position in your setup, am I right? However, I can not determine if there is an issue because I am not able to replicate the same. Would you like to help me in reproducing the problem that you encounter? Do you need further assistance?
I am providing my sample project for your reference. If you are still having any doubts or need further assistance, it would be greatly appreciated to modify my project in a way to reproduce the problem that you are facing and mimic your setup. Thus, I should be able to understand the exact case and provide further guidance, if needed. Thank you in advance for your understanding and help.
The only way to get the Grid to start with COLUMN 1 visible was to ensure my underlying datasource's entity First Field was in ordinal position 0. In my case, I have the grid auto-generate the columns when I assign the data to the data source. Then I programmatically change the order of those columns, by moving the first column from position 0 to position 5 (off screen to the right) to meet the needs of the specific grid. This causes the grid to position the view so that the class's first field is visible based on its ordinal position in the underlying class. Note that the width of columns must be larger than the view of the grid.
If this is still not clear, I will create a sample application and attach it.
I have updated the code in the RadFrom1.cs file to show you what is happening. This might be by design, but it's a problem for our system, as our customers always want to start with the grid focused on the leftmost column. As you can see, when you run, the grid positions itself so that the field with an Ordinal position of 0 is visible. Field10 is Ordinal position 0 in Class2, but I want it to be Last in my grid.
Hello, Mark,
I am not sure if I understand you correctly, but it seems that the horizontal scrollbar comes in the middle on your side when you have more columns in grid exceeding the visual area. I suppose there is something different in your setup that causes this because by default the scrollbar should remain in the begging at the most left area showing the firstly added columns. This behavior can be observed in our grid demos as well. Below you can see the result on my end after I added 10 column in a grid in my test project:
Reading your second reply in this thread, I understand that you managed to get the scrollbar in desired position in your setup, am I right? However, I can not determine if there is an issue because I am not able to replicate the same. Would you like to help me in reproducing the problem that you encounter? Do you need further assistance?
I am providing my sample project for your reference. If you are still having any doubts or need further assistance, it would be greatly appreciated to modify my project in a way to reproduce the problem that you are facing and mimic your setup. Thus, I should be able to understand the exact case and provide further guidance, if needed. Thank you in advance for your understanding and help.
I am looking forward to your reply.
The only way to get the Grid to start with COLUMN 1 visible was to ensure my underlying datasource's entity First Field was in ordinal position 0. In my case, I have the grid auto-generate the columns when I assign the data to the data source. Then I programmatically change the order of those columns, by moving the first column from position 0 to position 5 (off screen to the right) to meet the needs of the specific grid. This causes the grid to position the view so that the class's first field is visible based on its ordinal position in the underlying class. Note that the width of columns must be larger than the view of the grid.
If this is still not clear, I will create a sample application and attach it.
I have updated the code in the RadFrom1.cs file to show you what is happening. This might be by design, but it's a problem for our system, as our customers always want to start with the grid focused on the leftmost column. As you can see, when you run, the grid positions itself so that the field with an Ordinal position of 0 is visible. Field10 is Ordinal position 0 in Class2, but I want it to be Last in my grid.
using System; using System.Collections.Generic; using Telerik.WinControls.UI; namespace RadGrid_columns { public partial class RadForm1 : Telerik.WinControls.UI.RadForm { #region Public Constructors public RadForm1() { InitializeComponent(); //for (int i = 0; i < 10; i++) //{ // GridViewTextBoxColumn textBoxColumn = new GridViewTextBoxColumn(); // textBoxColumn.HeaderText = "TextBoxColumn" + i; // radGridView1.Columns.Add(textBoxColumn); //} } #endregion Public Constructors #region Private Methods private void RadForm1_Load(object sender, EventArgs e) { List<Class2> myDataList = new List<Class2> { new Class2 { Field0 = "Field 0", Field1 = "Field 1", Field2 = "Field 2", Field3 = "Field 3", Field4 = "Field 4", Field5 = "Field 5", Field6 = "Field 6", Field7 = "Field 7", Field8 = "Field 8", Field9 = "Field 9 ", Field10 = "Field 10" } }; radGridView1.BeginUpdate(); radGridView1.AutoGenerateColumns = true; radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; radGridView1.DataSource = myDataList; radGridView1.Columns.Move(radGridView1.Columns["Field10"].Index, 10); radGridView1.BestFitColumns(BestFitColumnMode.AllCells); radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.None; radGridView1.AllowRowResize = true; radGridView1.EndUpdate(); radGridView1.ClearSelection(); radGridView1.CurrentRow = null; Refresh(); } #endregion Private Methods #region Public Classes public class Class1 { #region Public Properties public string Field0 { get; set; } public string Field1 { get; set; } public string Field2 { get; set; } public string Field3 { get; set; } public string Field4 { get; set; } public string Field5 { get; set; } public string Field6 { get; set; } #endregion Public Properties } public class Class2 : Class1 { #region Public Properties public string Field10 { get; set; } public string Field7 { get; set; } public string Field8 { get; set; } public string Field9 { get; set; } #endregion Public Properties } #endregion Public Classes } }