convert server side vb.net to client side javascript

Posted by rockinthesixstring on Stack Overflow See other posts from Stack Overflow or by rockinthesixstring
Published on 2010-03-20T19:39:56Z Indexed on 2010/03/20 19:41 UTC
Read the original article Hit count: 318

Filed under:
|

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 %>')


}

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about JavaScript