If a grid column is added within code, is there a way to get its column position to persist after a user moves it - like any other grid column? I'm adding the column to the grid in the Page_Load event in a graph extension, but it doesn't seem to magically know what position it was moved like the others because it is being added each time. Could there be a setting I'm missing, or would I have to roll my own position persistence to get this to work?
Page 1 / 1
Hi
Most likely your column is not registered in the GridPreferences
table.
I didn’t try it, but probably you can register it in the Page_Load event something like this:
var gridPreferences = GridPreferences.Get("SCREEN_ID", "UserName", "ViewName").ToList();
if (gridPreferences.FirstOrDefault(it => it.DataField == "dataField") == null) {
gridPreferences.Add(new GridPreferences.ColumnPref(
dataField: "dataField",
visible: true,
order: 0,
width: 50)
);
GridPreferences.Set("SCREEN_ID", "UserName", "ViewName", gridPreferences.ToArray());
}
Thanks
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.