Accesing textboxs inside a table.

Discussion in 'ASP .Net' started by Slim, Jul 31, 2006.

  1. Slim

    Slim Guest

    Accessing textboxes inside a table.

    I am trying to access controls in a table like this
    customerLastSales.Rows(i).Cells(j).Controls(0)

    but asp.net says
    customerLastSales.Rows(i).Cells(j).Controls(0) does not have property called
    text.

    How can I them with out knowing their individual ID's?
     
    Slim, Jul 31, 2006
    #1
    1. Advertisements

  2. Slim

    Slim Guest

    I tried this,

    dim tb as Textbox
    tb = customerLastSales.Rows(i).Cells(j).Controls(0)

    xxx = tb.text

    but did not work

    Ok just occurred to me you mean like this


    dim tb as Textbox
    tb = cType( customerLastSales.Rows(i).Cells(j).Controls(0),textbox)
    xxx = tb.text

    I will give that a try at work Wednesday


     
    Slim, Jul 31, 2006
    #2
    1. Advertisements

  3. Slim

    Slim Guest

    made a demo, it worked fine

     
    Slim, Jul 31, 2006
    #3
  4. Slim

    Slim Guest

     
    Slim, Jul 31, 2006
    #4
  5. Slim

    Slim Guest

    thanks

     
    Slim, Jul 31, 2006
    #5
  6. You need to typecast customerLastSales.Rows(i).Cells(j).Controls(0) to a
    textbox.
     
    Eliyahu Goldin, Jul 31, 2006
    #6
  7. Yes, something like this. I am not with vb, so I can't confirm the exact
    syntax.
    --
    Eliyahu Goldin,
    Software Developer & Consultant
    Microsoft MVP [ASP.NET]

     
    Eliyahu Goldin, Jul 31, 2006
    #7
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.