how to Hide Column
-------------------
private void ultraGrid1_InitializeLayout{
 foreach (UltraGridColumn oColumn in (sender as UltraGrid  ) .DisplayLayout.Bands[0].Columns)
            {
                switch (oColumn.Key.ToUpper())
                {
                    case "ISFORMULA":
                        oColumn.Hidden = true;
                        break;
                    case "ISTITLE":
                        oColumn.Hidden = true;
                        break;
                    case "ISITEM":
                        oColumn.Hidden = true;
                        break;
                    case "ISSUBTOTAL":
                        oColumn.Hidden = true;
                        break;
                }
            }
}
Setting cell Value
--------------------
ultraGrid1.ActiveRow.Cells[0].SetValue("",false);
How to Focus on a Cell
-------------------------
 ultraGrid1.PerformAction(UltraGridAction.EnterEditMode, false, false);
 to exit the edit mode 
 ultraGrid1.PerformAction(UltraGridAction.ExitEditMode, false, false);
Coloring Rows/Cell
-------------------
ultraGrid1.DisplayLayout.Rows[rowindex].CellAppearance.BackColor = Color.Gray;
Cell.Appearance.BackColor = Color.Red;
How to on Enter move to next Cell that has Focus(Text)
-------------------
void NextControlFocus()
        { 
            int index=ultraGrid1.ActiveCell.Column.Index;
            ultraGrid1.ActiveRow.Cells[index+1].Activate();
            ultraGrid1.PerformAction(UltraGridAction.EnterEditMode, false, false);
        }
How to Get the Object that Bind to The grid current Row
-------------------------------------------------------
1.((object)BindingContext[ultraGrid1.DataSource].Current); Or
2.ultraGrid1.ActiveRow.ListObject
How to for a Cell to be a multiline Text and have scrollbar and always prompt when edit mode?
--------------------------------------------------------
On Initialize Layout
ultraGrid1.DisplayLayout.Bands[0].Columns["Description"].CellMultiLine = DefaultableBoolean.True;
ultraGrid1.DisplayLayout.Bands[0].Columns["Description"].VertScrollBar = true;
e.Layout.ScrollStyle = ScrollStyle.Immediate;
How to Process Data from ClipBoard or Ctrl+C
--------------------------------------------
on Key Down.
switch (e.KeyData)
            { 
                case Keys.Control|Keys.V:
                    this.ProcessData();
On ProcessData
DataObject o = Clipboard.GetDataObject() as DataObject;
if (!o.GetDataPresent("Text")) return; //Make sure we have Clipboard text
string theClipboardText = (string)o.GetData("Text", true);
How to Resize?
---------------
1.ultraGrid1.Rows.Band.Columns[1].PerformAutoResize();
2.AutoFitStyle
How to Validate Each Cell in row before leaving?
-------------------------------------------------
OnLast Cell key press refer to
 private bool ValidateAllCellinRow()
        {
            CellsCollection allcell = ultraGrid1.ActiveRow.Cells;
            foreach (UltraGridCell tmp in allcell)
            {
                if (tmp.Text == "" )
                {
                    MessageBox.Show(tmp.Column.Key + " May not be empty");
                    ultraGrid1.ActiveRow.Cells[tmp.Column.Key].Activate();
                    ultraGrid1.PerformAction(UltraGridAction.EnterEditMode, false, false);
                    return false;
                }
            }
            return true;
        }
how to delete silently
--------------------------
ultraGrid1.ActiveRow.Delete(false);
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar