F
Fredrik Rodin
All,
I've been trying to get this question answered before and I got some hints,
but nothing that really fit my needs.
Here's what I'm aiming at:
I create x number of LinkButton at run-time in a UserControl, no probs.
However, when I click on on of them, I want to fetch which one of them that
was clicked and a value which is assigned via lnkbtn.ID (I could also take
the .text attribute, but I prefer the .ID).
Here is my simple sample code:
For a As Integer = 0 To 5
Dim lnkbtn As New LinkButton
lnkbtn.ID = "lnkbtn_" & CType(a, String)
lnkbtn.Text = "Linkbutton " & a
Me.Controls.Add(lnkbtn)
Next
So far so good. Now, how do I write a procedure that fetch the button
clicked? I want to get the text or the ID from that button.
I've been on Google, a number of forums and MSDN but can't find anything
that really explains this.
I'm writing everything in VB. One suggestion I got was to use a DataList,
but that doesn't really work for me.
Please note:
I DON'T add anything in design-time.
All help appreciated!
Thanks,
Fredrik
I've been trying to get this question answered before and I got some hints,
but nothing that really fit my needs.
Here's what I'm aiming at:
I create x number of LinkButton at run-time in a UserControl, no probs.
However, when I click on on of them, I want to fetch which one of them that
was clicked and a value which is assigned via lnkbtn.ID (I could also take
the .text attribute, but I prefer the .ID).
Here is my simple sample code:
For a As Integer = 0 To 5
Dim lnkbtn As New LinkButton
lnkbtn.ID = "lnkbtn_" & CType(a, String)
lnkbtn.Text = "Linkbutton " & a
Me.Controls.Add(lnkbtn)
Next
So far so good. Now, how do I write a procedure that fetch the button
clicked? I want to get the text or the ID from that button.
I've been on Google, a number of forums and MSDN but can't find anything
that really explains this.
I'm writing everything in VB. One suggestion I got was to use a DataList,
but that doesn't really work for me.
Please note:
I DON'T add anything in design-time.
All help appreciated!
Thanks,
Fredrik