nature
01-06-2004, 08:27 AM
I'm trying to generate buttons dynamically AND set the OnClick event. dynamically as well. I can generate the buttons but I get the error message when I try to set the OnClick event. I want to use the same event no matter which button is clicked, so knowing the default name would suffice. Thanks much! Carl
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30390: 'System.Web.UI.WebControls.Button.Protected Overridable Sub OnClick(e As System.EventArgs)' is not accessible in this context
because it is 'Protected'.
Source Error:
Line 24: btnButton.id = dtrLinkTypes("lt_link_type_cd")
Line 25: btnButton.text = dtrLinkTypes("lt_link_type_cd_desc")
Line 26: btnButton.OnClick="btn_ButtonClick"
Line 27: plhLinkTypes.controls.add(btnButton)
Line 28: litLabel = new LiteralControl
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30390: 'System.Web.UI.WebControls.Button.Protected Overridable Sub OnClick(e As System.EventArgs)' is not accessible in this context
because it is 'Protected'.
Source Error:
Line 24: btnButton.id = dtrLinkTypes("lt_link_type_cd")
Line 25: btnButton.text = dtrLinkTypes("lt_link_type_cd_desc")
Line 26: btnButton.OnClick="btn_ButtonClick"
Line 27: plhLinkTypes.controls.add(btnButton)
Line 28: litLabel = new LiteralControl