By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,357 Members | 1,021 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,357 IT Pros & Developers. It's quick & easy.

Event firing twice

P: n/a
I have loop that builds table rows, it also attaches events, this works fine
on all but the last row, where the event fires twice

I have autowireup set to false

any ideas?

For i = 0 To UBound(oCountries.getCountries)

Dim tr As TableRow = New TableRow

Dim td As TableCell = New TableCell

btCountry = New Button

AddHandler btCountry.Click, AddressOf CountryButtClick

btCountry.OnClientClick = "waitForIt()"

btCountry.Attributes.Add("class", "dButtons")

btCountry.CommandArgument = oCountries.getCountries(i).id

btCountry.BackColor = Drawing.Color.Transparent

btCountry.BorderStyle = BorderStyle.None

btCountry.Text = oCountries.getCountries(i).Name

td.Controls.Add(btCountry)

tr.Cells.Add(td)

countryTable.Rows.Add(tr)

Next
Dec 29 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Slim" <me@here.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
For i = 0 To UBound(oCountries.getCountries)
For i = 0 To UBound(oCountries.getCountries) - 1

I'm actually quite surprised your code doesn't generate an "index out of
bounds" error...
Dec 29 '06 #2

P: n/a

"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:uc**************@TK2MSFTNGP04.phx.gbl...
"Slim" <me@here.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>For i = 0 To UBound(oCountries.getCountries)

For i = 0 To UBound(oCountries.getCountries) - 1

I'm actually quite surprised your code doesn't generate an "index out of
bounds" error...
If I put a -1 I get one value short, its when you use the count property you
need to use -1, I always get them mixed up myself.

But I found my problem, I was attaching a event plus I had the "handles
btCountry.Click" on the event also.


Dec 29 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.