convert server side vb.net to client side javascript
- by rockinthesixstring
I've got a function I wrote quite some time ago that works fine, but I'd like to speed up the process and lessen server load by doing the same job in Javascript.
I seem to be able to GET textbox values ok, but I can't seem to SET textbox values (I'm'-a JS noob). Can anyone lend a hand in converting my VB.NET code to it's JS equivalent?
Protected Sub txtSellingPrice_TextChanged(ByVal sender As Object, ByVal e As EventArgs) _
Handles txtSellingPrice.TextChanged
Dim SellingPrice As Double = Double.Parse(txtSellingPrice.Text.Replace("$", ""))
Dim BallanceSheet As Double = If(txtBalanceSheet.Text = "", 0, Double.Parse(txtBalanceSheet.Text.Replace("$", "")))
Dim DownPayment As Double = If(txtDownPayment.Text = "", 0, Double.Parse(txtDownPayment.Text.Replace("$", "")))
txtGoodWill.Text = SellingPrice - BallanceSheet
txtBalance.Text = SellingPrice - DownPayment
txtSellingPriceMult.Text = SellingPrice
End Sub
I've got this so far, but I'm not sure how to get much further.
function txtSellingPrice_OnChange() {
var txtSellingPrice = document.getElementById('<%=txtSellingPrice.ClientID %>')
var txtBalanceSheet = document.getElementById('<%=txtBalanceSheet.ClientID %>')
var txtDownPayment = document.getElementById('<%=txtDownPayment.ClientID %>')
}