Button Control in VB .NET
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
Re: Button Control in VB .NET
Why does this question have a tick sign against it in the rating? Could anyone throw some light on it?
Thanks
Abhijit
Re: Button Control in VB .NET
The tick sign indicates you are "subscribed" to this thread, thats is if you have the email featured turned on, then you would get an mail when someone replies to this thread.
Now the question:
Code:
Dim objTextBox As New TextBox
objTextBox.Text = "Some Value"
objTextBox.Visible = True
Panel1.Controls.Add(objTextBox)
'Where Panel1 is a panel inside the form tags
Re: Button Control in VB .NET