I apologize if I am not getting what you are saying. There is no code =
in my InitializeComponent procedure to look at. I attempted different =
variations of your code line below. The procedure I am trying to call =
is cbCheckChanged so I used that in the eventargs parenthesis but that =
didn't work because "new" said I was overriding it and it takes no =
arguments.
Here is my code again:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As =
System.EventArgs) Handles MyBase.Load
Dim Row As New TableRow()
tblClass.Rows.Add(Row) 'tblClass is my precreated table
Dim i As Integer
For i =3D 0 To 5
Dim cell As New TableCell()
Row.Cells.Add(cell)
Dim cb As New CheckBox()
cb.ID =3D "cb" & i
cb.AutoPostBack =3D True
cb.Checked =3D True
cb.Checked +=3D New EventArgs(Me.cbCheckChanged(sender, e))
cb.Attributes.Add("OnCheckedChanged", "cbCheckChanged")
cell.Controls.Add(cb)
Next i
End Sub
Public Sub cbCheckChanged(ByVal sender As System.Object, ByVal e As =
System.EventArgs)
Trace.Warn("works here")
End Sub
All help is appreciated.
"Alvin Bruney" <vapordan_spam_me_not@hotmail_no_spamhotmail.com> wrote =
in message news:OM7iLqCPDHA.2316@TK2MSFTNGP11.phx.gbl...
[quoted text, click to view] > wire your oncheckchanged event to its handler. look at initialize =
component
> function in the aspx page to get an idea how to do it.
> cb.Check +=3D new eventargs(this.control_checkchanged) roughly
>=20
> "Rob C" <rclint@uwsp.edu> wrote in message =
news:3efb3f45$1@news2.uwsp.edu...
> Hi all,
>=20
> I am dynamically creating checkboxes and am having trouble getting =
them to
> launch the OnCheckedChanged event when they are clicked. I am am =
getting a
> Postback event when they are checked or unchecked but that is all.
>=20
> Here is the code I am using to create my checkboxes in the Page_load
> function:
> For i =3D 0 To 5
> Dim cell As New TableCell()
> Row.Cells.Add(cell)
> Dim cb As New CheckBox()
> cb.ID =3D "cb" & i
> cb.AutoPostBack =3D True
> cb.Checked =3D True
> cb.Attributes.Add("OnCheckedChanged", "cbCheckChanged")
> cell.Controls.Add(cb)
> Next i
>=20
> If I add a checkbox to the apsx page manually then it calls the event =
just
> fine.
>=20
> All help is appreciated.
>=20
> Rob C.
>=20