[thelist] ASP.NET Adding a linkbutton programmatically

Peter Brunone (EasyListBox.com) peter at easylistbox.com
Mon Aug 7 14:35:47 CDT 2006



   Are you trying to attach a server-side event or a client-side event?  If the former, then how are you specifying the subroutine name (you should feed it a reference to the sub rather than a string), and what is the error?  If the latter, then you need to hit the Attributes collection instead, e.g.

lbAlpha.Attributes.Add("onclick", "runSomeClientFunction()")

Cheers,

Peter

				From: "Casey Crookston" caseyc at IntelliSoftmn.com

Ok, moving right along with this phonebook.... Now that we have the data
imported correctly into the database, one of the search options is to
display the alphabet from A to Z. When the user clicks on a letter, it
will display all the categories that begin with the selected letter.

For i = 65 To 90

Dim lbAlpha As LinkButton = New LinkButton

lbAlpha.Text = "&#" & i & "; "

lbAlpha.CssClass = "alpha_link"

lbAlpha.Onclick = [function name] <- error here

plhAlpha.Controls.Add(lbAlpha)

Next

Why is it that I can't assign an onclick event when creating a link
button programmatically? 

Thanks,

Casey



More information about the thelist mailing list