unable to access the values of input elements created using javascript

Discussion in 'ASP .Net' started by Vikram, Apr 6, 2005.

  1. Vikram

    Vikram Guest

    I have added some input elements on a page using
    javascript at client side.
    when i submit the page, i am unable to access the values
    of input elements created using request.form.
    Are elements created using javascript are available at the
    server?
    if not how can i do the above thing so that there values
    can be accessed.
    I dont want to postback page everytime i need to create a
    new element.
    Vikram, Apr 6, 2005
    #1
    1. Advertising

  2. Vikram

    James Steele Guest

    Vikram,

    When you create your input elements are you adding the runat="server"
    attribute? That should make the control available on the server (I
    think). Of course you will have to cast it to the proper type.

    Let me know how you make out.
    James Steele, Apr 6, 2005
    #2
    1. Advertising

  3. Vikram

    Vikram Guest

    No basically after a page is displyed at client, user can
    click a '+" button which will create text box without
    posting back to server i.e. using javascript.
    After that user will submit the page.....
    >-----Original Message-----
    >Vikram,
    >
    >When you create your input elements are you adding the

    runat="server"
    >attribute? That should make the control available on the

    server (I
    >think). Of course you will have to cast it to the proper

    type.
    >
    >Let me know how you make out.
    >
    >.
    >
    Vikram, Apr 6, 2005
    #3
  4. Are you adding the name property of the control? Without the name property
    I do believe the element is not considered postable.

    <input type="text" name="txtDynamic" />

    Request.Forms["txtDynamic"];

    bill

    "Vikram" <> wrote in message
    news:0f9601c53ab3$9d019210$...
    > I have added some input elements on a page using
    > javascript at client side.
    > when i submit the page, i am unable to access the values
    > of input elements created using request.form.
    > Are elements created using javascript are available at the
    > server?
    > if not how can i do the above thing so that there values
    > can be accessed.
    > I dont want to postback page everytime i need to create a
    > new element.
    >
    William F. Robertson, Jr., Apr 6, 2005
    #4
  5. Vikram

    James Steele Guest

    Understood. But when that textbox is created you must specify certain
    attributes of the input element Such as the name property (as Bill
    pointed out). Then if you want to access these WHEN the postback occurs
    you will also have to add the runat=server attribute.

    Send a code snippet if you like and we can get it you work for you.
    James Steele, Apr 6, 2005
    #5
  6. Vikram

    Bruce Barker Guest

    you are probably missing the name attribute. try:

    in browser:

    <script>
    document.write('<input type="text" name="myText" value="test value">
    </script>

    on postback:

    sting myValue = Request.Form["myText"];

    -- bruce (sqlwork.com)


    "Vikram" <> wrote in message
    news:0f9601c53ab3$9d019210$...
    >I have added some input elements on a page using
    > javascript at client side.
    > when i submit the page, i am unable to access the values
    > of input elements created using request.form.
    > Are elements created using javascript are available at the
    > server?
    > if not how can i do the above thing so that there values
    > can be accessed.
    > I dont want to postback page everytime i need to create a
    > new element.
    >
    Bruce Barker, Apr 6, 2005
    #6
  7. Vikram

    Vikram Guest

    Thanks a lot.
    U were right
    >-----Original Message-----
    >you are probably missing the name attribute. try:
    >
    >in browser:
    >
    ><script>
    >document.write('<input type="text" name="myText"

    value="test value">
    ></script>
    >
    >on postback:
    >
    >sting myValue = Request.Form["myText"];
    >
    >-- bruce (sqlwork.com)
    >
    >
    >"Vikram" <> wrote in

    message
    >news:0f9601c53ab3$9d019210$...
    >>I have added some input elements on a page using
    >> javascript at client side.
    >> when i submit the page, i am unable to access the values
    >> of input elements created using request.form.
    >> Are elements created using javascript are available at

    the
    >> server?
    >> if not how can i do the above thing so that there values
    >> can be accessed.
    >> I dont want to postback page everytime i need to create

    a
    >> new element.
    >>

    >
    >
    >.
    >
    Vikram, Apr 7, 2005
    #7
    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. jprunier
    Replies:
    1
    Views:
    323
    Karl Heinz Buchegger
    Aug 31, 2004
  2. Melissa
    Replies:
    2
    Views:
    607
    Gaurav Vaish \(a.k.a. MasterGaurav\)
    Dec 26, 2008
  3. Arti Singh
    Replies:
    2
    Views:
    134
    Arti Singh
    Jul 26, 2010
  4. Will
    Replies:
    1
    Views:
    108
    lallous
    Jan 23, 2004
  5. Replies:
    1
    Views:
    120
    Michael Winter
    Apr 24, 2006
Loading...

Share This Page