|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
clicked event never firesWhen this butotn is clicked I don't get the clicked event. I've removed almost all the code and I'm down to a very basic example. I've made similar controls in the past and have never had this problem. In fact, the code below is almost an exact copy of code that works when extending a textBox. I'm probably over looking something very simple. Here is my class: Imports System.ComponentModel Imports System.Web.UI Imports System.Web.UI.WebControls <DefaultProperty("Text"), ToolboxData("<{0}:AutoDataGrid runat=server></{0}:AutoDataGrid>")> Public Class AutoDataGrid Inherits System.Web.UI.WebControls.DataGrid Protected WithEvents someBtn As System.Web.UI.WebControls.ImageButton Protected Overrides Sub CreateChildControls() someBtn = New ImageButton Me.Controls.Add(someBtn) End Sub Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter) ensurechildcontrols() someBtn.RenderControl(writer) MyBase.Render(writer) End Sub Private Sub someBtn_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles someBtn.Click Dim i As Integer i = 5 End Sub End Class Please check this someBtn_Click event registered or not in system generated
code. some times these events can be missed. so that, it won't identify this event. Please check once and let me know. Thanks Dotnetsrini Try using the AddHandler method after you declare each instance of
someBtn and before you add that instance to the parent control. Your code looks correct for an image button that is already declared in HTML but not for an image button that is dynamically created and added. I've tried all the suggestions I have gotten so far before I posted the
question. I've done a little more research and it seems that there are problems with adding Controls to a Control inherited from DataGrid. The suggestions I've seen suggest that I inherit from WebControl but then I can't use the DataGrid property builder at design time.
"Cannot have multiple items selected in a DropDownList" Error
How to get ListItemValue and ListItemText from a Combo using SendMessage edit attribute values of a web control just before control rendered to the page (control's Load even Atlas UpdatePanel with Webparts events inheritance checkbox bind with 0 = checked? Problems with dynamically created GridView/DetailsView Removing columns from Gridview(2.0) databinding on templatefileds dont work? Rendering a Treeview Control DataGrid item dropdownlist javascript disable |
|||||||||||||||||||||||