grabbing values from standard INPUT TEXT fields that are being dynamically written?

Discussion in 'ASP .Net' started by Darrel, Nov 13, 2004.

  1. Darrel

    Darrel Guest

    I'm writing out my own Table via codebehind. Each row has an INPUT
    TYPE="TEXT" that I am writing out dynamically as well.

    I want people to be able to update this text, then, upon submit, I'm going
    to walk through each one to update the DB.

    How do I access these form fields from the codebehind? I know I can put a
    RUNAT="SERVER" on this and then I could register it in the codebehind, but I
    can't predict how many INPUTS I'll need on the page. The catch is that I
    can't register an object that hasn't been written to the page yet, so any
    attempt at referencing the item in my codebehind just gives me an error.

    (I do realize that using a datagrid would work, but I need the HTML output
    to by much more customized than the default datagrid output..namely for
    accessibility reasons)

    -Darrel
     
    Darrel, Nov 13, 2004
    #1
    1. Advertising

  2. Darrel

    Scott M. Guest

    You can grab any and all form data via the Request object.

    Dim user as String = Request("txtUser")


    "Darrel" <> wrote in message
    news:...
    > I'm writing out my own Table via codebehind. Each row has an INPUT
    > TYPE="TEXT" that I am writing out dynamically as well.
    >
    > I want people to be able to update this text, then, upon submit, I'm going
    > to walk through each one to update the DB.
    >
    > How do I access these form fields from the codebehind? I know I can put a
    > RUNAT="SERVER" on this and then I could register it in the codebehind, but
    > I can't predict how many INPUTS I'll need on the page. The catch is that I
    > can't register an object that hasn't been written to the page yet, so any
    > attempt at referencing the item in my codebehind just gives me an error.
    >
    > (I do realize that using a datagrid would work, but I need the HTML output
    > to by much more customized than the default datagrid output..namely for
    > accessibility reasons)
    >
    > -Darrel
    >
     
    Scott M., Nov 13, 2004
    #2
    1. Advertising

  3. Darrel

    Darrel Guest

    > Dim user as String = Request("txtUser")

    Argh. So simple. Thanks! ;o)
     
    Darrel, Nov 13, 2004
    #3
  4. Darrel

    Scott M. Guest

    ....And, if you don't know the names of the items or how many there will be
    you can do this:

    Dim I as Integer
    Dim formValue() as String
    For I = 0 to Request.Forms.Count -1
    formValue(I) = Request(I)
    Next

    After this is done, you have all the form data stored in an Array.

    "Darrel" <> wrote in message
    news:...
    >> Dim user as String = Request("txtUser")

    >
    > Argh. So simple. Thanks! ;o)
    >
     
    Scott M., Nov 13, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?T3JiaXRhbGU=?=

    How to access input fields written into a label field

    =?Utf-8?B?T3JiaXRhbGU=?=, Mar 31, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    374
    Peter Rilling
    Mar 31, 2006
  2. Replies:
    8
    Views:
    242
  3. Kermit Piper

    Grabbing ASCII values in a text box

    Kermit Piper, Mar 10, 2006, in forum: Javascript
    Replies:
    1
    Views:
    147
  4. Kermit Piper
    Replies:
    1
    Views:
    154
    Thomas 'PointedEars' Lahn
    Mar 12, 2006
  5. Replies:
    23
    Views:
    560
    Tim Streater
    Dec 18, 2013
Loading...

Share This Page