Hello,
There are two ultragrids.I need selected rows from first grid to add second grid.Row by row.To set every row cells different editor controls.
Please, help
Could you please review the sample attached to this post and see if it meets your requirements. Please feel free to let me know if I misunderstood you or if you have any other questions.
Hello Borisov.Thanks a lot.I have another question , too.When I load ultragrid the checkbox column default state is checked.How to set it unchecked?Default state.
Hello Ilkin,
The added check editor control was just to show an example of how you can have different editors to the different cells in one column. The state of the checkbox is determined by the 'ultraCheckEditor1' control instance. In this particular case, the column is of type string, so the checkeditor do not know what state to put the checkbox in. You could change the code in the else statement with the following one, assigning a 'false' value to the cell:
private void ultraGrid1_InitializeRow(object sender, InitializeRowEventArgs e)
{
if (e.Row.Index < 1)
e.Row.Cells[0].EditorComponent = ultraFormattedTextEditor1;
else
e.Row.Cells[0].EditorComponent = ultraCheckEditor1;
e.Row.Cells[0].Value = false;
}
I am not sure what your final goal is, but it would be hard to deal with different editors in the same column, please keep this in mind.
Feel free to contact me if you need any additional assistance.
Thanks a lot.
Boris which event to use for ultraggrid checkbox check ?I used cell_change but it populate my code when user checks second row.Not from first.For example when I check first cell it doesnt add this row to datatable.Only,when I check second row it add first row to datatable.
Thanks
Ilkin,
How are you getting the value of the cell? Is it from the .Value property? It does not update, because by default the 'WinGrid' updates the value when you exit editmode, but when clicking on the checkbox you are still in editmode. So my suggestion is to use the .Text property of the cell in order to get the right value.
Please let me know if this helps.
Boris ,
My code is below :
foreach (UltraGridRow row_1 in ultraGrid3.Rows) { if ((bool)row_1.GetCellBoolValue("Sec") == true) { DataRow row = dt_2.NewRow(); row[0] = row_1.Cells["Suallar"].Text; row[10] = row_1.Cells["Table_Name"].Text; dt_2.Rows.Add(row);
Hi,
There is no "default". The value of the checkbox comes from the value of the field in the data source, assuming the column is bound. So your data source needs to return false in every cell for the column.
If it's an unbound column, then the default is unchecked. If it's showing up checked, then something in your code must be setting the value of the cells in the unbound column to true.
Hello Mike Saltzman.
Thanks .I have another question.How to make ultragrid checkbox column default state unchecked?When it loads checkbox column state is checked.
Thanks in advance.
The problem here is probably GetCellBoolValue. There is no such method on the UltraGridRow, so I assume that's an extender method? Anyway, you are probably accessing the Value property of the cell, which won't be updated until the user leaves the cell. Instead of using Value, use Text property of the grid cell and use bool.Parse to convert that text into a boolean for a checkbox column.