[thelist] .NET: AutoPostBack on Items Added programmatically

Casey Crookston caseyc at IntelliSoftmn.com
Thu Apr 12 17:43:55 CDT 2007

On the same note as below, I have a link button in a control which is
added to the page dynanmicaly.  I'm having trouble recognizing it's
click.  This is what I have:

Dim lbCalc As LinkButton = new_control.FindControl("lbCalc")
AddHandler lbCalc.Click, AddressOf lbCalc_Click

Sub lbCalc_Click(ByVal sender As Object, ByVal e As EventArgs)
	' do things
End Sub

But, we are never making it into lbCalc_Click. I know it's simple, but I
can't seem to pin it.

Thanks, Casey

-----Original Message-----
From: Peter Brunone 

Hi Casey,

    Since you're adding an event handler, you need to use the following

AddHandler drpBuilderBigNo.SelectedIndexChanged, AddressOf

...and then you would define the sub itself this way:

Protected Sub drpBuilderBigNo_SelectedIndexChanged(ByVal sender As
Object, ByVal e As EventArgs) 
    ' do stuff 
End Sub



From: "Casey Crookston" caseyc at IntelliSoftmn.com 


I am adding rows to a table programmatically. In one of the table
cells, I am adding a drop down list as such:

Dim drpBuilderBigNo As New DropDownList

[cut a bunch of lines of code]

drpBuilderBigNo.AutoPostBack = True




More information about the thelist mailing list