Results 1 to 7 of 7

Thread: How To Retrive From dynamic textbox

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2004
    Posts
    24

    How To Retrive From dynamic textbox

    Hi guys,

    here is my code
    Code:
     For j = 0 To ds.Tables(1).Rows.Count - 1
                            Dim rw As New TableRow
                            For k = 0 To ds.Tables(1).Columns.Count - 1
                                Dim cel As New TableCell
                                Dim txt As New TextBox
                                txt.ID = "cel" & j & k
                                txt.Text = ds.Tables(1).Rows(j).Item(k)
                                cel.Controls.Add(txt)
                                rw.Cells.Add(cel)
                            Next
                            tbl.Rows.Add(rw)
                        Next
    i am able to populate the textboxes in the table but not able to retrieve the values from it can anyone help me out in this
    thank u

  2. #2
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267

    Re: How To Retrive From dynamic textbox

    How are you trying to get the info out? You should be able to do it with a loop simular to the one you use to add them.

    Also, I'm not sure what your doing but why are you adding a cell? If you adding a cell it's going to throw off your TextBox ID Schema.
    Last edited by Magiaus; Jan 29th, 2005 at 10:38 AM.
    Magiaus

    If I helped give me some points.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Mar 2004
    Posts
    24

    Re: How To Retrive From dynamic textbox

    thanks magaius for ur reply
    but can u help in generating a new row in the table with textboxes i have tried to do it but it is generating only one row in button click

  4. #4
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267

    Re: How To Retrive From dynamic textbox

    Can you tell me some about what your goal is? I can give you better information with more information.
    Magiaus

    If I helped give me some points.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Mar 2004
    Posts
    24

    Re: How To Retrive From dynamic textbox

    hi magius
    i have table in which i have kept textboxes in every cell which acts like a flexgrid i am able to populate the the data into the textboxes and now i want a new row with textboxes when we click the add button i could able to get only one row even after we click more than once here is my code for adding a row
    [code]

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Try
    Dim i, j As Integer
    For i = 1 To 1
    Dim rw As New TableRow
    For j = 0 To 8

    Dim cel As New TableCell
    Dim txt As New TextBox
    txt.ID = "cel" & i & j
    'txt.Text = ds.Tables(1).Rows(i).Item(j)
    txt.BorderStyle = BorderStyle.Groove
    txt.Style("width") = 75
    cel.Controls.Add(txt)
    rw.Cells.Add(cel)
    Next
    tbl.Rows.Add(rw)
    Next

    Catch ex As Exception
    Response.Write(ex.Message)
    End Try
    End Sub
    [\code]

  6. #6
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267

    Re: How To Retrive From dynamic textbox

    You have to requery and readd every postback. If you add a row and data is saved it will show up when you reload the data. thus you only have one row that isn't stored. The new row. I'm going to post a nasty hack in a minute that gets around this.
    Last edited by Magiaus; Jan 29th, 2005 at 09:42 PM.
    Magiaus

    If I helped give me some points.

  7. #7
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267

    Nasty...?

    As I said I think this is a nasty hack.

    http://netnsite.com/flex_test.aspx

    I even did it in VB. It was hard since I don't remember VB. Give me some points lol
    Attached Files Attached Files
    Magiaus

    If I helped give me some points.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width