Acessing the Dynamically created Html Input Text in codebehind file

use like this:

1.At ASPX page:

< form id="form1" runat="server" >
< div id="div1" runat="server" >
< /div >
< div >
< asp:Button ID="Button1" runat="server" Text="Button" />
< / div >
< / form >

2.and at server side:

view plaincopy to clipboardprint?
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
div1.InnerHtml &= " < input type=""text"" id=""cntrl001"" name=""cntrl001"" />"
End If
End Sub

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
Response.Write(Request.Form("cntrl001").ToString)
End Sub

No comments:

Post a Comment