Build an ASP.NET JavaScript Generator: Listing 1.

Passing values to CalculateTaxes.

Dim but As Button
Dim ProductId As String
Dim quantity As Integer
Dim price As Decimal
Dim discount As Decimal
Dim extendedPrice As Decimal

If e.Row.RowIndex  >= 0 Then
  but = CType(e.Row.Cells(4).Controls(0), Button)
  ProductId = e.Row.Cells(1).Text
  price = Convert.ToDecimal(e.Row.Cells(2).Text)
  discount = Convert.ToDecimal(e.Row.Cells(3).Text)
  quantity = Convert.ToDecimal(e.Row.Cells(4).Text)
  extendedPrice = price * quantity * (1 - discount)
  but.OnClientClick = "CalculateTaxes(" & taxRate & "," & 
    ProductId & ", " & quantity & ", " & 
    price & ", " & discount & ")"
End If

About the Author

Peter Vogel is a system architect and principal in PH&V Information Services. PH&V provides full-stack consulting from UX design through object modeling to database design. Peter tweets about his VSM columns with the hashtag #vogelarticles. His blog posts on user experience design can be found at http://blog.learningtree.com/tag/ui/.

comments powered by Disqus

Featured

  • Decision Tree Regression from Scratch Using C#

    Dr. James McCaffrey of Microsoft Research says the technique is easy to tune, works well with small datasets and produces highly interpretable predictions, but there are also trade-off cons.

  • Visual Studio 'Tea & Technology' Video Miniseries Starts Next Week

    The goal of the miniseries is to provide an insider's snapshot look at some of the people who contribute to shaping the Visual Studio IDE every day.

  • Microsoft Releases OpenJDK 21 Build for Java Jockeys

    Microsoft today announced its "Microsoft Build of OpenJDK 21," taking advantage of new features and functionality in Java 21.

  • 'Dev Home' Update Leads Developer Goodies in AI-Powered Windows 11 Update

    Along with today's new AI-powered Windows 11 update come new goodies for developers, including a new edition of Dev Home, a preview offering described as a "control center" providing coding-focused features and functionality.

Subscribe on YouTube