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

Passing A Value To Server

P: n/a
Basic Web Form... A few text boxes and a checkbox - and a card reader...
The effect I want to accomplish is this:

The basic credit card fields are there and can be filled out. But if the
user swipes the card, I want to fill out the fields automatically and make
them read only. (So far I can do this.)

But I also want a checkbox to appear that indicates the card was swiped.
The user can clear the checkbox, re-enabling the fields so they can be
edited, but then I will no longer consider the data as being swiped. I want
the check box to disappear if they clear it.

Using server controls, if I create a checkbox, but make it not visible, then
it's not available at the client side to work with from client side code.
So I would need to send some flag back to the server to indicate a post back
and have the page re-rendered properly. But how do send info to the server
like that without having a visible control to attach the data to?

(Does this make any sense? Not sure if I'm explaining it well.)

Is there a way to send a value back to the server, in a postback, where the
data is not a property of a server control that's tracking viewstate? The
session object is only available on the server side right?

Any guidance here is appreciated. Thanks.

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


P: n/a
to send additional value to server , one commonly used method is

a HiddenControl (you will access it like Request.Forms["HiddenContrlName"]
from code behind)

or a TextBox Webcontrol with size 0 or attribute style='display:none' ..

But if the only purpose of post back is to display/check the checkbox ,
probabaly a better approach is to do the display/check in the client side
javascript ..

Instead of settign Visibility=False, you would just add an attribute to
make it hidden , but still available at client code

CheckBoxName.Attributes.Add("style='display:none'" )

"Jerry Camel" wrote:
Basic Web Form... A few text boxes and a checkbox - and a card reader...
The effect I want to accomplish is this:

The basic credit card fields are there and can be filled out. But if the
user swipes the card, I want to fill out the fields automatically and make
them read only. (So far I can do this.)

But I also want a checkbox to appear that indicates the card was swiped.
The user can clear the checkbox, re-enabling the fields so they can be
edited, but then I will no longer consider the data as being swiped. I want
the check box to disappear if they clear it.

Using server controls, if I create a checkbox, but make it not visible, then
it's not available at the client side to work with from client side code.
So I would need to send some flag back to the server to indicate a post back
and have the page re-rendered properly. But how do send info to the server
like that without having a visible control to attach the data to?

(Does this make any sense? Not sure if I'm explaining it well.)

Is there a way to send a value back to the server, in a postback, where the
data is not a property of a server control that's tracking viewstate? The
session object is only available on the server side right?

Any guidance here is appreciated. Thanks.

Jerry

Nov 19 '05 #2

P: n/a
Okay... I can have the checkbox on the form and available with 'Display:
None'...

But I can't seem to find the proper syntax to change the display state and
make it visible on the client side...

Thanks.
"Sreejith Ram" <Sr*********@discussions.microsoft.com> wrote in message
news:43**********************************@microsof t.com...
to send additional value to server , one commonly used method is

a HiddenControl (you will access it like Request.Forms["HiddenContrlName"]
from code behind)

or a TextBox Webcontrol with size 0 or attribute style='display:none' ..

But if the only purpose of post back is to display/check the checkbox ,
probabaly a better approach is to do the display/check in the client side
javascript ..

Instead of settign Visibility=False, you would just add an attribute to
make it hidden , but still available at client code

CheckBoxName.Attributes.Add("style='display:none'" )

"Jerry Camel" wrote:
Basic Web Form... A few text boxes and a checkbox - and a card reader... The effect I want to accomplish is this:

The basic credit card fields are there and can be filled out. But if the user swipes the card, I want to fill out the fields automatically and make them read only. (So far I can do this.)

But I also want a checkbox to appear that indicates the card was swiped.
The user can clear the checkbox, re-enabling the fields so they can be
edited, but then I will no longer consider the data as being swiped. I want the check box to disappear if they clear it.

Using server controls, if I create a checkbox, but make it not visible, then it's not available at the client side to work with from client side code. So I would need to send some flag back to the server to indicate a post back and have the page re-rendered properly. But how do send info to the server like that without having a visible control to attach the data to?

(Does this make any sense? Not sure if I'm explaining it well.)

Is there a way to send a value back to the server, in a postback, where the data is not a property of a server control that's tracking viewstate? The session object is only available on the server side right?

Any guidance here is appreciated. Thanks.

Jerry

Nov 19 '05 #3

P: n/a
Syntax to display ?

document.getElementById("CheckBoxClientName").styl e.display='' ;
document.getElementById("CheckBoxClientName").Chec ked = true;

this may help...
http://www.w3schools.com/htmldom/dom_obj_checkbox.asp
http://www.w3schools.com/htmldom/dom...yle.asp#layout

"Jerry Camel" wrote:
Okay... I can have the checkbox on the form and available with 'Display:
None'...

But I can't seem to find the proper syntax to change the display state and
make it visible on the client side...

Thanks.
"Sreejith Ram" <Sr*********@discussions.microsoft.com> wrote in message
news:43**********************************@microsof t.com...
to send additional value to server , one commonly used method is

a HiddenControl (you will access it like Request.Forms["HiddenContrlName"]
from code behind)

or a TextBox Webcontrol with size 0 or attribute style='display:none' ..

But if the only purpose of post back is to display/check the checkbox ,
probabaly a better approach is to do the display/check in the client side
javascript ..

Instead of settign Visibility=False, you would just add an attribute to
make it hidden , but still available at client code

CheckBoxName.Attributes.Add("style='display:none'" )

"Jerry Camel" wrote:
Basic Web Form... A few text boxes and a checkbox - and a card reader... The effect I want to accomplish is this:

The basic credit card fields are there and can be filled out. But if the user swipes the card, I want to fill out the fields automatically and make them read only. (So far I can do this.)

But I also want a checkbox to appear that indicates the card was swiped.
The user can clear the checkbox, re-enabling the fields so they can be
edited, but then I will no longer consider the data as being swiped. I want the check box to disappear if they clear it.

Using server controls, if I create a checkbox, but make it not visible, then it's not available at the client side to work with from client side code. So I would need to send some flag back to the server to indicate a post back and have the page re-rendered properly. But how do send info to the server like that without having a visible control to attach the data to?

(Does this make any sense? Not sure if I'm explaining it well.)

Is there a way to send a value back to the server, in a postback, where the data is not a property of a server control that's tracking viewstate? The session object is only available on the server side right?

Any guidance here is appreciated. Thanks.

Jerry


Nov 19 '05 #4

P: n/a
Thanks, but this doesn't seem to have any effect. I tried changing the
style.display property to all kinds of values, but the checkbox never
appears...

Jerry

"Sreejith Ram" <Sr*********@discussions.microsoft.com> wrote in message
news:51**********************************@microsof t.com...
Syntax to display ?

document.getElementById("CheckBoxClientName").styl e.display='' ;
document.getElementById("CheckBoxClientName").Chec ked = true;

this may help...
http://www.w3schools.com/htmldom/dom_obj_checkbox.asp
http://www.w3schools.com/htmldom/dom...yle.asp#layout

"Jerry Camel" wrote:
Okay... I can have the checkbox on the form and available with 'Display: None'...

But I can't seem to find the proper syntax to change the display state and make it visible on the client side...

Thanks.
"Sreejith Ram" <Sr*********@discussions.microsoft.com> wrote in message
news:43**********************************@microsof t.com...
to send additional value to server , one commonly used method is

a HiddenControl (you will access it like Request.Forms["HiddenContrlName"] from code behind)

or a TextBox Webcontrol with size 0 or attribute style='display:none' ...
But if the only purpose of post back is to display/check the checkbox , probabaly a better approach is to do the display/check in the client side javascript ..

Instead of settign Visibility=False, you would just add an attribute to make it hidden , but still available at client code

CheckBoxName.Attributes.Add("style='display:none'" )

"Jerry Camel" wrote:

> Basic Web Form... A few text boxes and a checkbox - and a card

reader...
> The effect I want to accomplish is this:
>
> The basic credit card fields are there and can be filled out. But if
the
> user swipes the card, I want to fill out the fields automatically
and make
> them read only. (So far I can do this.)
>
> But I also want a checkbox to appear that indicates the card was
swiped. > The user can clear the checkbox, re-enabling the fields so they can be > edited, but then I will no longer consider the data as being swiped.

I want
> the check box to disappear if they clear it.
>
> Using server controls, if I create a checkbox, but make it not
visible, then
> it's not available at the client side to work with from client side

code.
> So I would need to send some flag back to the server to indicate a
post back
> and have the page re-rendered properly. But how do send info to the

server
> like that without having a visible control to attach the data to?
>
> (Does this make any sense? Not sure if I'm explaining it well.)
>
> Is there a way to send a value back to the server, in a postback,
where the
> data is not a property of a server control that's tracking
viewstate? The
> session object is only available on the server side right?
>
> Any guidance here is appreciated. Thanks.
>
> Jerry
>
>
>


Nov 19 '05 #5

P: n/a
Obviously there is some thing not right other than the syntax.. :) .. Is
there any javascript error when you call the function to display the
checkbox?...

if still no luck, you may want to create a simple HTML page with only
following code in it...

<INPUT TYPE=checkbox ID=chk1 style='display:hidden'>
<INPUT TYPE=button ID=btn1 onClick="toggle()" value="Click to Toggle
Display" >

<script>
function toggle(id)
{
el = document.getElementById("chk1");
var display = el.style.display ? '' : 'none';
el.style.display = display;
}
</script>

Once this works, you can compare with the HTML your aspx generated and that
may help in finding the issue..

This link got a working sample... with code...pls see if this helps..
http://www.sam-i-am.com/work/sandbox...e_display.html

"Jerry Camel" wrote:
Thanks, but this doesn't seem to have any effect. I tried changing the
style.display property to all kinds of values, but the checkbox never
appears...

Jerry

"Sreejith Ram" <Sr*********@discussions.microsoft.com> wrote in message
news:51**********************************@microsof t.com...
Syntax to display ?

document.getElementById("CheckBoxClientName").styl e.display='' ;
document.getElementById("CheckBoxClientName").Chec ked = true;

this may help...
http://www.w3schools.com/htmldom/dom_obj_checkbox.asp
http://www.w3schools.com/htmldom/dom...yle.asp#layout

"Jerry Camel" wrote:
Okay... I can have the checkbox on the form and available with 'Display: None'...

But I can't seem to find the proper syntax to change the display state and make it visible on the client side...

Thanks.
"Sreejith Ram" <Sr*********@discussions.microsoft.com> wrote in message
news:43**********************************@microsof t.com...
> to send additional value to server , one commonly used method is
>
> a HiddenControl (you will access it like Request.Forms["HiddenContrlName"] > from code behind)
>
> or a TextBox Webcontrol with size 0 or attribute style='display:none' ... >
> But if the only purpose of post back is to display/check the checkbox , > probabaly a better approach is to do the display/check in the client side > javascript ..
>
> Instead of settign Visibility=False, you would just add an attribute to > make it hidden , but still available at client code
>
> CheckBoxName.Attributes.Add("style='display:none'" )
>
>
>
> "Jerry Camel" wrote:
>
> > Basic Web Form... A few text boxes and a checkbox - and a card
reader...
> > The effect I want to accomplish is this:
> >
> > The basic credit card fields are there and can be filled out. But if the
> > user swipes the card, I want to fill out the fields automatically and make
> > them read only. (So far I can do this.)
> >
> > But I also want a checkbox to appear that indicates the card was swiped. > > The user can clear the checkbox, re-enabling the fields so they can be > > edited, but then I will no longer consider the data as being swiped. I want
> > the check box to disappear if they clear it.
> >
> > Using server controls, if I create a checkbox, but make it not visible, then
> > it's not available at the client side to work with from client side
code.
> > So I would need to send some flag back to the server to indicate a post back
> > and have the page re-rendered properly. But how do send info to the
server
> > like that without having a visible control to attach the data to?
> >
> > (Does this make any sense? Not sure if I'm explaining it well.)
> >
> > Is there a way to send a value back to the server, in a postback, where the
> > data is not a property of a server control that's tracking viewstate? The
> > session object is only available on the server side right?
> >
> > Any guidance here is appreciated. Thanks.
> >
> > Jerry
> >
> >
> >


Nov 19 '05 #6

P: n/a
I'll play with it. Thanks for your help. I was trying to use vbscript, but
I may have to switch to javascript...

Jerry

"Sreejith Ram" <Sr*********@discussions.microsoft.com> wrote in message
news:54**********************************@microsof t.com...
Obviously there is some thing not right other than the syntax.. :) .. Is
there any javascript error when you call the function to display the
checkbox?...

if still no luck, you may want to create a simple HTML page with only
following code in it...

<INPUT TYPE=checkbox ID=chk1 style='display:hidden'>
<INPUT TYPE=button ID=btn1 onClick="toggle()" value="Click to Toggle
Display" >

<script>
function toggle(id)
{
el = document.getElementById("chk1");
var display = el.style.display ? '' : 'none';
el.style.display = display;
}
</script>

Once this works, you can compare with the HTML your aspx generated and that may help in finding the issue..

This link got a working sample... with code...pls see if this helps..
http://www.sam-i-am.com/work/sandbox...e_display.html

"Jerry Camel" wrote:
Thanks, but this doesn't seem to have any effect. I tried changing the
style.display property to all kinds of values, but the checkbox never
appears...

Jerry

"Sreejith Ram" <Sr*********@discussions.microsoft.com> wrote in message
news:51**********************************@microsof t.com...
Syntax to display ?

document.getElementById("CheckBoxClientName").styl e.display='' ; document.getElementById("CheckBoxClientName").Chec ked = true;
this may help...
http://www.w3schools.com/htmldom/dom_obj_checkbox.asp
http://www.w3schools.com/htmldom/dom...yle.asp#layout

"Jerry Camel" wrote:

> Okay... I can have the checkbox on the form and available with

'Display:
> None'...
>
> But I can't seem to find the proper syntax to change the display state
and
> make it visible on the client side...
>
> Thanks.
>
>
> "Sreejith Ram" <Sr*********@discussions.microsoft.com> wrote in
message > news:43**********************************@microsof t.com...
> > to send additional value to server , one commonly used method is
> >
> > a HiddenControl (you will access it like

Request.Forms["HiddenContrlName"]
> > from code behind)
> >
> > or a TextBox Webcontrol with size 0 or attribute style='display:none' ...
> >
> > But if the only purpose of post back is to display/check the
checkbox ,
> > probabaly a better approach is to do the display/check in the
client side
> > javascript ..
> >
> > Instead of settign Visibility=False, you would just add an
attribute to
> > make it hidden , but still available at client code
> >
> > CheckBoxName.Attributes.Add("style='display:none'" )
> >
> >
> >
> > "Jerry Camel" wrote:
> >
> > > Basic Web Form... A few text boxes and a checkbox - and a card
> reader...
> > > The effect I want to accomplish is this:
> > >
> > > The basic credit card fields are there and can be filled out.
But if
> the
> > > user swipes the card, I want to fill out the fields
automatically and
> make
> > > them read only. (So far I can do this.)
> > >
> > > But I also want a checkbox to appear that indicates the card was

swiped.
> > > The user can clear the checkbox, re-enabling the fields so they
can be
> > > edited, but then I will no longer consider the data as being
swiped. I
> want
> > > the check box to disappear if they clear it.
> > >
> > > Using server controls, if I create a checkbox, but make it not

visible,
> then
> > > it's not available at the client side to work with from client
side > code.
> > > So I would need to send some flag back to the server to indicate a post
> back
> > > and have the page re-rendered properly. But how do send info to
the > server
> > > like that without having a visible control to attach the data to? > > >
> > > (Does this make any sense? Not sure if I'm explaining it well.)
> > >
> > > Is there a way to send a value back to the server, in a

postback, where
> the
> > > data is not a property of a server control that's tracking

viewstate?
> The
> > > session object is only available on the server side right?
> > >
> > > Any guidance here is appreciated. Thanks.
> > >
> > > Jerry
> > >
> > >
> > >
>
>
>


Nov 19 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.