By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,301 Members | 3,575 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,301 IT Pros & Developers. It's quick & easy.

unable to access the values of input elements created using javascript

P: n/a
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.

Nov 19 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
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.

Nov 19 '05 #2

P: n/a
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 (Ithink). Of course you will have to cast it to the proper type.
Let me know how you make out.

.

Nov 19 '05 #3

P: n/a
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" <an*******@discussions.microsoft.com> wrote in message
news:0f****************************@phx.gbl...
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.

Nov 19 '05 #4

P: n/a
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.

Nov 19 '05 #5

P: n/a
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" <an*******@discussions.microsoft.com> wrote in message
news:0f****************************@phx.gbl...
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.

Nov 19 '05 #6

P: n/a
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" <an*******@discussions.microsoft.com> wrote in messagenews:0f****************************@phx.gbl...
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.

.

Nov 19 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.