I don't have a lot of experience with dynamically-created controls yet, so
I'm not sure if it's efficient (or correct) but I was able to get this
control to call this server-side event...
< %@Import <mailto:%@Import> Namespace="System"%>
<%@ Page Language="vb" AutoEventWireup="false" %>
<HTML>
<HEAD>
<SCRIPT runat=server>
Protected WithEvents LinkButton as new LinkButton()
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
LinkButton.Text = "Link Text"
LinkButton.ID = "LinkID"
PlaceHolder1.Controls.Add(LinkButton)
End Sub
Public Sub X(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles LinkButton.Click
Response.Write("running function X<br>")
End Sub
</SCRIPT>
</HEAD>
<body>
<form id=frmX runat=server>
<asp:PlaceHolder id=PlaceHolder1 runat="server"></asp:PlaceHolder>
</form>
</body>
</HTML>
the line --- Protected WithEvents LinkButton as new LinkButton()
--- is important because it creates a "holding variable" for the server-side
code to use and bind the
event to. If it's not possible to pre-define your
dynamic controls w/ pre-known variables - then this example won't be of much
help...