Custom control linkbutton events

T

Tony

Hi,

I hope someone can help. I've created a custom webcontrol library
which generates a web table, and within each row dynamically creates a
LinkButton control.

The Linkbutton code looks like this :

oGenRow = New TableRow

oLnkRemove = New WebControls.LinkButton
oLnkRemove.Text = "remove now"
oLnkRemove.CommandName = "Remove"
oLnkRemove.CommandArgument =
CType(oIdictEnum.Current, DataRowView).Item("ID").ToString()
oLnkRemove.CausesValidation = True
oLnkRemove.Attributes.Add("name",
oLnkRemove.ClientID)
'oLnkRemove.Attributes.Add("href",
"javascript:__doPostBack('lnkRemove_" + iRow.ToString + "','')")
oLnkRemove.EnableViewState = True
oLnkRemove.ID = "lnkRemove_" +
iRow.ToString

This is then added to the control collection of the table cell object,
which is then added to the row, and so on.

The problem I've got is even if I user the AddHandler command for the
Command event of the Linkbutton, the rendered output just renders an
anchor with no properties, so you can't click it and no event is fired
off.

I've tried load of things based on solutions online, but some look
really complicated (loads of delegates etc), and others that just
don't work.

It seems such a simple thing to be able to do. Perhaps I'm
misunderstanding how the custom web control interacts with the page
it's placed on - at this point I'm completely lost!

Hope someone can help,
Tony
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top