Hi,

I wan to create dynamic button control in VB .NET. Is it possible. I am writing the following code but it doesnt show any button on the web page. Any input on what I may be doing wrong is welcome. "I Do not want to drag and drop a button on webform1.aspx page, I want to create a button using webform1.aspx.cs page.

Thanks
Abhijit

:

Public Class WebForm1
Inherits System.Web.UI.Page


#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents Button2 As System.Web.UI.WebControls.Button
'Protected WithEvents a As AxSpreadsheet

'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it
Private designerPlaceholderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Button2 = New Button
Button2.EnableViewState = True
Button2.Text = "Abhijit"
Button2.Visible = True
Button2.Enabled = True
End Sub