I've created a custom control whereby I have a number of Panels (defined by the user) stored in a collection. When rendered, I need each Panel to render a LinkButton with a CommandArgument.
When I try this, there are two problems:
- Because of the above, no postback occurs so I can't even test whether the CommandArgument is getting posted back!
Can anyone help me out? I've Google this and found lots of similar posts but with no answer.
Here's my render code which currently isn't doing what it should...
Protected Overrides Sub Render(ByVal writer As HtmlTextWriter)
If MyPanelsCollection IsNot Nothing AndAlso MyPanelsCollection.Count > 0 Then
For Each p As Panel In MyPanelsCollection
Dim lb As New LinkButton
lb.CommandArgument = MyPanelsCollection.IndexOf(p).ToString
AddHandler lb.Command, AddressOf LinkButtonCommandSub
lb.Text = "Link " & MyPanelsCollection.Indexof(p).toString ' text set to Link 0, Link 1 etc'
View Complete Post