Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
getting problem on key up and down column value is increment /decrements by 1in ultragrid
posted

Hi,

I am using infragistic 14.2 . In ultra grid i set data using data source. in that i want  one column is editable.

i set following property for it.

With UGridQueue.DisplayLayout.Bands(0)
.Columns("Memo Carat Price").DataType = GetType(System.Double)
.Columns("Memo Carat Price").Format = "#,##0.00;(#,##0.00)"
.Columns("Memo Carat Price").MaskInput = "{LOC}nn,nnn,nnn.nn"
.Columns("Memo Carat Price").PromptChar = ""

End With

its working fine. 

but i want navigation on key up and down

so i written following code on 

Private Sub UGridQueue_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles UGridQueue.KeyUp

Case Keys.Up
' ugriddll4.fn_UGridKeyMovements(UGridQueue, e)
If UGridQueue.ActiveRow.Cells("Total Memo Price").IsActiveCell Then
If UGridQueue.ActiveRow.Index <> (UGridQueue.Rows.Count - 1) Then
If Len(IIf(IsDBNull(UGridQueue.Rows(UGridQueue.ActiveRow.Index - 1).Cells("LotName").Value), "", UGridQueue.Rows(UGridQueue.ActiveRow.Index - 1).Cells("LotName").Value)) > 0 Then
UGridQueue.PerformAction(UltraGridAction.PrevRow)
UGridQueue.ActiveRow.Cells("Total Memo Price").Activate()
UGridQueue.PerformAction(UltraGridAction.EnterEditMode)
Else

End If

End If

End If

end sub

so using above code i can move  next cell/previous cell on key up/down

but when i press key up/down values get increment by 1 and then go to the next cell. 

For. Eg . carat price 3200.01 when press key up it becomes 3200.02 and go to next cell

so please help me that how can i restrict  it.i dont want to be change the value on key up/down

Parents
No Data
Reply
  • 23930
    Offline posted

    Hi Poonam,

    Thank you for the contacting Infragistics Developer Support.

    What you could do in order to prevent this behavior is to remove the KeyActionMappings which are causing it. This way you can use your code and it won’t increment the values in the cell. In order to do this you could use the following code:

    Dim mappings = UltraGrid1.KeyActionMappings.Cast(Of GridKeyActionMapping)().

                Where(Function(m) (m.KeyCode = Keys.Up Or m.KeyCode = Keys.Down) _

                          And (m.ActionCode = UltraGridAction.AboveCell Or m.ActionCode = UltraGridAction.BelowCell)).ToList()

    For Each mapping In mappings

                UltraGrid1.KeyActionMappings.Remove(mapping)

    Next

    For more information on KeyActionMappings please visit this link:

    http://help.infragistics.com/Doc/WinForms/2014.1/CLR4.0/?page=Infragistics4.Win.UltraWinGrid.v14.1~Infragistics.Win.UltraWinGrid.UltraGrid~KeyActionMappings.html

    I have attached a sample in order to demonstrate this.

    Let me know if you have any additional questions.

    WG_PreventValueIncrement.zip
Children