Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. how to access textboxid dynamically

how to access textboxid dynamically

Scheduled Pinned Locked Moved ASP.NET
tutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vbmadhavi
    wrote on last edited by
    #1

    hello , i create text boxes dynamically.i can't get text box value in another button.iam sending my code this is iam developing Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If textbox1.Text <> "" Then CreateControl() End If End Sub Private Sub CreateControl() Dim i As Integer = 0 For i = 1 To 10 Dim txt As TextBox = New TextBox ' txt.ID = "txt" & i txt.ID = "txt_" & i txt.text="hello" Session("text") = txt.ID Panel1.Controls.Add(txt) Next End Sub Protected Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.Click Dim i As Integer For i = 1 To 10 Dim txtCtrl As TextBox = DirectCast(Panel1.FindControl("txt_" & i), TextBox) If txtCtrl.Text <> Nothing Then MsgBox(txtCtrl.Text) End If Next End Sub here i can get text box values one by one.but i dont wont that. here 10 text boxes are there,in which,i want one textbox value which is selected in number of text boxes. urgently i want solution plz send reply to me

    P 1 Reply Last reply
    0
    • V vbmadhavi

      hello , i create text boxes dynamically.i can't get text box value in another button.iam sending my code this is iam developing Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If textbox1.Text <> "" Then CreateControl() End If End Sub Private Sub CreateControl() Dim i As Integer = 0 For i = 1 To 10 Dim txt As TextBox = New TextBox ' txt.ID = "txt" & i txt.ID = "txt_" & i txt.text="hello" Session("text") = txt.ID Panel1.Controls.Add(txt) Next End Sub Protected Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.Click Dim i As Integer For i = 1 To 10 Dim txtCtrl As TextBox = DirectCast(Panel1.FindControl("txt_" & i), TextBox) If txtCtrl.Text <> Nothing Then MsgBox(txtCtrl.Text) End If Next End Sub here i can get text box values one by one.but i dont wont that. here 10 text boxes are there,in which,i want one textbox value which is selected in number of text boxes. urgently i want solution plz send reply to me

      P Offline
      P Offline
      Prosanta Kundu online
      wrote on last edited by
      #2

      Hi Could you please give more information. "Textbox is selected" ... Thanks Prosanta

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups