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
255
Is there a way to Update a cell automatically other then in an Event
posted

I have a grid that needs to perform calculations.  I am using the ugrdAScheduleMaint_UpdateCell event, though the page refreshes every time a cell is changed.  It does what is suppose to but I was seeing if there was a way to prevent the refresh of the entire page.  I am using VB 2003 .NET 2.0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Private

 

 

Sub ugrdAScheduleMaint_UpdateCell(ByVal sender As Object, ByVal e As Infragistics.WebUI.UltraWebGrid.CellEventArgs) Handles

ugrdAScheduleMaint.UpdateCell

 

 

'Sets Accrual Rate value to zero when Cost Method is choosen in Accrual Method

 

 

If e.Cell.Row.Cells(ColumnIndex("Accrual Method")).Value = 2

Then

e.Cell.Row.Cells(ColumnIndex("Accrual Rate")).Value = 0

 

 

End

If

 

 

 

'sets the format for percentage columns in the UltraWebGrid

 

 

Select Case

e.Cell.Column.Header.Caption

 

 

Case "Accrual Rate" : e.Cell.Text = CDec

(e.Cell.Text.Replace("%", "")).ToString("N4") & "%"

 

 

Case "IRR" : e.Cell.Text = CDec

(e.Cell.Text.Replace("%", "")).ToString("n4") & "%"

 

 

End

Select

 

 

'solves the interest formula.

 

 

Dim decInterest As Decimal

= _

(

 

CDec

(e.Cell.Row.Cells(ColumnIndex("Accrual Rate")).Text.Replace("%", "")) _

*

 

CDec

(e.Cell.Row.Cells(ColumnIndex("Beginning CV")).Text.Replace("$", "").Replace(",", ""))) _

/ 12

e.Cell.Row.Cells(ColumnIndex("Interest")).Value = decInterest

 

 

 

'Solves the ending balance Formula (begbal + interest + Advances .....

 

 

Dim eBalance As Decimal

= _

(

 

CDec

(e.Cell.Row.Cells(ColumnIndex("Beginning CV")).Text.Replace("$", "").Replace(",", ""))) + _

(

 

CDec

(e.Cell.Row.Cells(ColumnIndex("Advances")).Text.Replace("$", "").Replace(",", ""))) + _

(

 

CDec

(e.Cell.Row.Cells(ColumnIndex("Interest")).Text.Replace("$", "").Replace(",", ""))) + _

(

 

CDec

(e.Cell.Row.Cells(ColumnIndex("Gains Loss On Payoff")).Text.Replace("$", "").Replace(",", ""))) + _

(

 

CDec

(e.Cell.Row.Cells(ColumnIndex("Adjustments")).Text.Replace("$", "").Replace(",", ""))) - _

(

 

CDec

(e.Cell.Row.Cells(ColumnIndex("Provisions")).Text.Replace("$", "").Replace(",", ""))) + _

(

 

CDec

(e.Cell.Row.Cells(ColumnIndex("Recoveries")).Text.Replace("$", "").Replace(",", ""))) - _

(

 

CDec

(e.Cell.Row.Cells(ColumnIndex("Collections")).Text.Replace("$", "").Replace(",", "")))

e.Cell.Row.Cells(ColumnIndex("Ending CV")).Value = eBalance

 

 

 

Me.ugrdAScheduleMaint.Columns(ColumnIndex("Accrual Method")).ValueList = Me

.Session.Item("MethodValueList")

 

 

End

Sub