C
Chad Stoker
I have an array of Button Controls that have been extended. The container of
the Custom button array has registered a Hidden Field in the "OnPreRender"
override method like so :
<DefaultProperty("Text"), ToolboxData("<{0}:ChemicalSubstanceChart
runat=server></{0}:ChemicalSubstanceChart>")> _
Public Class ChemicalSubstanceChart
Inherits System.Web.UI.WebControls.WebControl
Protected _chemButtonArray() As CustomButton
..... blah blah .... some properties ......
Protected Overrides Sub OnPreRender(ByVal e As EventArgs)
MyBase.OnPreRender(e)
If Not Page Is Nothing Then
Page.RegisterHiddenField(Me.MyHiddenFieldID, "")
End If
End Sub
Protected Overrides Sub Render (ByVal output as
System.Web.UI.HtmlTextWriter)
Try
Dim i As Integer
For i = 0 To Me._chemButtonArray.Length - 1
Me._chemButtonArray(i).RenderControl(output)
Next
Catch ex As Exception
'Handle The Exception In A Custom Way
End Try
End Sub
End Class
And here is my CustomButton Class that I want to Register a Client-Side
Script Block in the OnPreRender method.
<DefaultProperty("Text"), ToolboxData("<{0}:CustomButton
runat=server></{0}:CustomButton>")> _
Public Class CustomButton
Inherits System.Web.UI.WebControls.Button
..... blah blah .... some properties ......
Protected Overrides Sub OnPreRender(ByVal e As EventArgs)
Page.RegisterClientScriptBlock("test","<script
language=""javascript"">function broken{alert('test');}</script>")
End Sub
Protected Overrides Sub Render (ByVal output as
System.Web.UI.HtmlTextWriter)
Me.Render(output)
End Sub
End Class
Why is the CustomButton Class NOT Executing OnPreRender?? I would really,
really, really like it to. Any ideas?
Thanks,
Chad
the Custom button array has registered a Hidden Field in the "OnPreRender"
override method like so :
<DefaultProperty("Text"), ToolboxData("<{0}:ChemicalSubstanceChart
runat=server></{0}:ChemicalSubstanceChart>")> _
Public Class ChemicalSubstanceChart
Inherits System.Web.UI.WebControls.WebControl
Protected _chemButtonArray() As CustomButton
..... blah blah .... some properties ......
Protected Overrides Sub OnPreRender(ByVal e As EventArgs)
MyBase.OnPreRender(e)
If Not Page Is Nothing Then
Page.RegisterHiddenField(Me.MyHiddenFieldID, "")
End If
End Sub
Protected Overrides Sub Render (ByVal output as
System.Web.UI.HtmlTextWriter)
Try
Dim i As Integer
For i = 0 To Me._chemButtonArray.Length - 1
Me._chemButtonArray(i).RenderControl(output)
Next
Catch ex As Exception
'Handle The Exception In A Custom Way
End Try
End Sub
End Class
And here is my CustomButton Class that I want to Register a Client-Side
Script Block in the OnPreRender method.
<DefaultProperty("Text"), ToolboxData("<{0}:CustomButton
runat=server></{0}:CustomButton>")> _
Public Class CustomButton
Inherits System.Web.UI.WebControls.Button
..... blah blah .... some properties ......
Protected Overrides Sub OnPreRender(ByVal e As EventArgs)
Page.RegisterClientScriptBlock("test","<script
language=""javascript"">function broken{alert('test');}</script>")
End Sub
Protected Overrides Sub Render (ByVal output as
System.Web.UI.HtmlTextWriter)
Me.Render(output)
End Sub
End Class
Why is the CustomButton Class NOT Executing OnPreRender?? I would really,
really, really like it to. Any ideas?
Thanks,
Chad