tags:

views:

131

answers:

1

I'm stuck in converting the rate in the datalist. My page contain one dropdownlist(currency converter), one datalist - inside contain the price of bags in labels. Now I uses the dropdownlist.selectedIndexchange

Protected Sub ddl_rate_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddl_rate.SelectedIndexChanged
 Dim lbl_rate As Label = roomList.Items.Item(0).FindControl("lbl_rate")
 Dim a As Integer = Convert.ToInt32(lbl_rate.Text)
  If ddl_rate.Text = "Australia Dollars (AUD)" Then
            Dim b As Integer = (a * 0.8029)
            lbl_rate.Text = b.ToString()

        ElseIf ddl_rate.Text = "Brazil Reais (BRL)" Then
            Dim b As Integer = (a * 1.3024)
            lbl_rate.Text = b.ToString()
 End If

Althought it did convert the rate, but it only convert the first row. Any suggestion?

A: 

this is a guess without seeing the rest of the code:

Protected Sub ddl_rate_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddl_rate.SelectedIndexChanged

  foreach(c as Control in roomList.Items)

    Dim lbl_rate As Label = c.FindControl("lbl_rate")
    Dim a As Integer = Convert.ToInt32(lbl_rate.Text)
    If ddl_rate.Text = "Australia Dollars (AUD)" Then
            Dim b As Integer = (a * 0.8029)
            lbl_rate.Text = b.ToString()

        ElseIf ddl_rate.Text = "Brazil Reais (BRL)" Then
            Dim b As Integer = (a * 1.3024)
            lbl_rate.Text = b.ToString()
    End If
 next
Hogan