在我的用户控件中,我有gridview,这个网格是使用Itemplate以编程方式创建的。在InstantiateIn方法中,我有这样的代码。
Select Case _templateType
Case ListItemType.Header
Dim linkButton As New LinkButton
linkButton.Text = "Delete"
linkButton.CommandName = "Click"
linkButton.CommandArgument = Me._columnID
container.Controls.Add(linkButton)我希望将Click事件连接到此LinkButton,并在后台代码中使用此事件。这是GridViewTemplate如何实现ITemplate的构造函数
Public Sub New(ByVal type As ListItemType, ByVal colname As String, Optional ByVal infoType As String = "")
'Stores the template type.
_templateType = type
'Stores the column name.
_columnName = colname
_infoType = infoType
_columnID = columID
End Sub我收到了这个来自用户控件的调用:
bfield.ItemTemplate = New GridViewTemplate(ListItemType.Item, dt.Columns(col).ColumnName, "label")哪里是
Dim bfield As TemplateField = New TemplateField()发布于 2010-11-27 06:01:20
AddHandler linkbutton.Click, AddressOf X 'X being the method that handles the click event.发布于 2010-11-27 06:02:31
AddHandler linkButton.Click, AddressOf linkButton_Click
Sub linkButton_Click(ByVal sender As System.Object, ByVal e As EventArgs)
' here is your click handler
End Subhttps://stackoverflow.com/questions/4288757
复制相似问题