Hi..
In this article I will explain about to create a control dynamically asp.net..It’s very simple process to learn and create a control in Dynamic….
First you have to decide where we have to create a link button at what position..After decide the position to add one div tag in that position. Now we are going to add a control in the div tag.
Write the following code to create a link button….
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Dim btn As New LinkButton
btn.ID = "btn"
btn.Text = "Click Me"
AddHandler btn.Click, AddressOf btn_Click
Me.dpan.Controls.Add(btn)’Dpan as div tag name
End Sub
After creating a control..also we make click event for the control after click the button code will execute…Follow the below code…creating click event………
Private Sub btn_Click(ByVal sender As Object, ByVal e As EventArgs)
Response.Write("Button is clicked")
End Sub
I hope this one helpful to all ………
0 comments:
Post a Comment