Connecting Tech Pros Worldwide Forums | Help | Site Map

Passing A Value To Server

Jerry Camel
Guest
 
Posts: n/a
#1: Nov 19 '05
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



Sreejith Ram
Guest
 
Posts: n/a
#2: Nov 19 '05

re: Passing A Value To Server


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:
[color=blue]
> 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
>
>
>[/color]
Jerry Camel
Guest
 
Posts: n/a
#3: Nov 19 '05

re: Passing A Value To Server


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" <SreejithRam@discussions.microsoft.com> wrote in message
news:431FA795-5920-4B2C-81E1-98224CD89497@microsoft.com...[color=blue]
> 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:
>[color=green]
> > Basic Web Form... A few text boxes and a checkbox - and a card[/color][/color]
reader...[color=blue][color=green]
> > The effect I want to accomplish is this:
> >
> > The basic credit card fields are there and can be filled out. But if[/color][/color]
the[color=blue][color=green]
> > user swipes the card, I want to fill out the fields automatically and[/color][/color]
make[color=blue][color=green]
> > 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[/color][/color]
want[color=blue][color=green]
> > the check box to disappear if they clear it.
> >
> > Using server controls, if I create a checkbox, but make it not visible,[/color][/color]
then[color=blue][color=green]
> > it's not available at the client side to work with from client side[/color][/color]
code.[color=blue][color=green]
> > So I would need to send some flag back to the server to indicate a post[/color][/color]
back[color=blue][color=green]
> > and have the page re-rendered properly. But how do send info to the[/color][/color]
server[color=blue][color=green]
> > 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[/color][/color]
the[color=blue][color=green]
> > data is not a property of a server control that's tracking viewstate?[/color][/color]
The[color=blue][color=green]
> > session object is only available on the server side right?
> >
> > Any guidance here is appreciated. Thanks.
> >
> > Jerry
> >
> >
> >[/color][/color]


Sreejith Ram
Guest
 
Posts: n/a
#4: Nov 19 '05

re: Passing A Value To Server


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:
[color=blue]
> 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" <SreejithRam@discussions.microsoft.com> wrote in message
> news:431FA795-5920-4B2C-81E1-98224CD89497@microsoft.com...[color=green]
> > 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:
> >[color=darkred]
> > > Basic Web Form... A few text boxes and a checkbox - and a card[/color][/color]
> reader...[color=green][color=darkred]
> > > The effect I want to accomplish is this:
> > >
> > > The basic credit card fields are there and can be filled out. But if[/color][/color]
> the[color=green][color=darkred]
> > > user swipes the card, I want to fill out the fields automatically and[/color][/color]
> make[color=green][color=darkred]
> > > 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[/color][/color]
> want[color=green][color=darkred]
> > > the check box to disappear if they clear it.
> > >
> > > Using server controls, if I create a checkbox, but make it not visible,[/color][/color]
> then[color=green][color=darkred]
> > > it's not available at the client side to work with from client side[/color][/color]
> code.[color=green][color=darkred]
> > > So I would need to send some flag back to the server to indicate a post[/color][/color]
> back[color=green][color=darkred]
> > > and have the page re-rendered properly. But how do send info to the[/color][/color]
> server[color=green][color=darkred]
> > > 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[/color][/color]
> the[color=green][color=darkred]
> > > data is not a property of a server control that's tracking viewstate?[/color][/color]
> The[color=green][color=darkred]
> > > session object is only available on the server side right?
> > >
> > > Any guidance here is appreciated. Thanks.
> > >
> > > Jerry
> > >
> > >
> > >[/color][/color]
>
>
>[/color]
Jerry Camel
Guest
 
Posts: n/a
#5: Nov 19 '05

re: Passing A Value To Server


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" <SreejithRam@discussions.microsoft.com> wrote in message
news:514C006A-51EE-42B4-938C-506D452587A4@microsoft.com...[color=blue]
> 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:
>[color=green]
> > Okay... I can have the checkbox on the form and available with[/color][/color]
'Display:[color=blue][color=green]
> > None'...
> >
> > But I can't seem to find the proper syntax to change the display state[/color][/color]
and[color=blue][color=green]
> > make it visible on the client side...
> >
> > Thanks.
> >
> >
> > "Sreejith Ram" <SreejithRam@discussions.microsoft.com> wrote in message
> > news:431FA795-5920-4B2C-81E1-98224CD89497@microsoft.com...[color=darkred]
> > > to send additional value to server , one commonly used method is
> > >
> > > a HiddenControl (you will access it like[/color][/color][/color]
Request.Forms["HiddenContrlName"][color=blue][color=green][color=darkred]
> > > from code behind)
> > >
> > > or a TextBox Webcontrol with size 0 or attribute style='display:none'[/color][/color][/color]
...[color=blue][color=green][color=darkred]
> > >
> > > But if the only purpose of post back is to display/check the checkbox[/color][/color][/color]
,[color=blue][color=green][color=darkred]
> > > probabaly a better approach is to do the display/check in the client[/color][/color][/color]
side[color=blue][color=green][color=darkred]
> > > javascript ..
> > >
> > > Instead of settign Visibility=False, you would just add an attribute[/color][/color][/color]
to[color=blue][color=green][color=darkred]
> > > 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[/color]
> > reader...[color=darkred]
> > > > The effect I want to accomplish is this:
> > > >
> > > > The basic credit card fields are there and can be filled out. But[/color][/color][/color]
if[color=blue][color=green]
> > the[color=darkred]
> > > > user swipes the card, I want to fill out the fields automatically[/color][/color][/color]
and[color=blue][color=green]
> > make[color=darkred]
> > > > them read only. (So far I can do this.)
> > > >
> > > > But I also want a checkbox to appear that indicates the card was[/color][/color][/color]
swiped.[color=blue][color=green][color=darkred]
> > > > The user can clear the checkbox, re-enabling the fields so they can[/color][/color][/color]
be[color=blue][color=green][color=darkred]
> > > > edited, but then I will no longer consider the data as being swiped.[/color][/color][/color]
I[color=blue][color=green]
> > want[color=darkred]
> > > > the check box to disappear if they clear it.
> > > >
> > > > Using server controls, if I create a checkbox, but make it not[/color][/color][/color]
visible,[color=blue][color=green]
> > then[color=darkred]
> > > > it's not available at the client side to work with from client side[/color]
> > code.[color=darkred]
> > > > So I would need to send some flag back to the server to indicate a[/color][/color][/color]
post[color=blue][color=green]
> > back[color=darkred]
> > > > and have the page re-rendered properly. But how do send info to the[/color]
> > server[color=darkred]
> > > > 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,[/color][/color][/color]
where[color=blue][color=green]
> > the[color=darkred]
> > > > data is not a property of a server control that's tracking[/color][/color][/color]
viewstate?[color=blue][color=green]
> > The[color=darkred]
> > > > session object is only available on the server side right?
> > > >
> > > > Any guidance here is appreciated. Thanks.
> > > >
> > > > Jerry
> > > >
> > > >
> > > >[/color]
> >
> >
> >[/color][/color]


Sreejith Ram
Guest
 
Posts: n/a
#6: Nov 19 '05

re: Passing A Value To Server


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:
[color=blue]
> 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" <SreejithRam@discussions.microsoft.com> wrote in message
> news:514C006A-51EE-42B4-938C-506D452587A4@microsoft.com...[color=green]
> > 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:
> >[color=darkred]
> > > Okay... I can have the checkbox on the form and available with[/color][/color]
> 'Display:[color=green][color=darkred]
> > > None'...
> > >
> > > But I can't seem to find the proper syntax to change the display state[/color][/color]
> and[color=green][color=darkred]
> > > make it visible on the client side...
> > >
> > > Thanks.
> > >
> > >
> > > "Sreejith Ram" <SreejithRam@discussions.microsoft.com> wrote in message
> > > news:431FA795-5920-4B2C-81E1-98224CD89497@microsoft.com...
> > > > to send additional value to server , one commonly used method is
> > > >
> > > > a HiddenControl (you will access it like[/color][/color]
> Request.Forms["HiddenContrlName"][color=green][color=darkred]
> > > > from code behind)
> > > >
> > > > or a TextBox Webcontrol with size 0 or attribute style='display:none'[/color][/color]
> ...[color=green][color=darkred]
> > > >
> > > > But if the only purpose of post back is to display/check the checkbox[/color][/color]
> ,[color=green][color=darkred]
> > > > probabaly a better approach is to do the display/check in the client[/color][/color]
> side[color=green][color=darkred]
> > > > javascript ..
> > > >
> > > > Instead of settign Visibility=False, you would just add an attribute[/color][/color]
> to[color=green][color=darkred]
> > > > 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[/color][/color]
> if[color=green][color=darkred]
> > > the
> > > > > user swipes the card, I want to fill out the fields automatically[/color][/color]
> and[color=green][color=darkred]
> > > make
> > > > > them read only. (So far I can do this.)
> > > > >
> > > > > But I also want a checkbox to appear that indicates the card was[/color][/color]
> swiped.[color=green][color=darkred]
> > > > > The user can clear the checkbox, re-enabling the fields so they can[/color][/color]
> be[color=green][color=darkred]
> > > > > edited, but then I will no longer consider the data as being swiped.[/color][/color]
> I[color=green][color=darkred]
> > > want
> > > > > the check box to disappear if they clear it.
> > > > >
> > > > > Using server controls, if I create a checkbox, but make it not[/color][/color]
> visible,[color=green][color=darkred]
> > > 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[/color][/color]
> post[color=green][color=darkred]
> > > 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,[/color][/color]
> where[color=green][color=darkred]
> > > the
> > > > > data is not a property of a server control that's tracking[/color][/color]
> viewstate?[color=green][color=darkred]
> > > The
> > > > > session object is only available on the server side right?
> > > > >
> > > > > Any guidance here is appreciated. Thanks.
> > > > >
> > > > > Jerry
> > > > >
> > > > >
> > > > >
> > >
> > >
> > >[/color][/color]
>
>
>[/color]
Jerry Camel
Guest
 
Posts: n/a
#7: Nov 19 '05

re: Passing A Value To Server


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" <SreejithRam@discussions.microsoft.com> wrote in message
news:54BF5C69-C844-40FF-A427-409FEAED12EE@microsoft.com...[color=blue]
> 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[/color]
that[color=blue]
> 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:
>[color=green]
> > 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" <SreejithRam@discussions.microsoft.com> wrote in message
> > news:514C006A-51EE-42B4-938C-506D452587A4@microsoft.com...[color=darkred]
> > > Syntax to display ?
> > >
> > >[/color][/color][/color]
document.getElementById("CheckBoxClientName").styl e.display='' ;[color=blue][color=green][color=darkred]
> > > document.getElementById("CheckBoxClientName").Chec ked =[/color][/color][/color]
true;[color=blue][color=green][color=darkred]
> > >
> > > 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[/color]
> > 'Display:[color=darkred]
> > > > None'...
> > > >
> > > > But I can't seem to find the proper syntax to change the display[/color][/color][/color]
state[color=blue][color=green]
> > and[color=darkred]
> > > > make it visible on the client side...
> > > >
> > > > Thanks.
> > > >
> > > >
> > > > "Sreejith Ram" <SreejithRam@discussions.microsoft.com> wrote in[/color][/color][/color]
message[color=blue][color=green][color=darkred]
> > > > news:431FA795-5920-4B2C-81E1-98224CD89497@microsoft.com...
> > > > > to send additional value to server , one commonly used method is
> > > > >
> > > > > a HiddenControl (you will access it like[/color]
> > Request.Forms["HiddenContrlName"][color=darkred]
> > > > > from code behind)
> > > > >
> > > > > or a TextBox Webcontrol with size 0 or attribute[/color][/color][/color]
style='display:none'[color=blue][color=green]
> > ...[color=darkred]
> > > > >
> > > > > But if the only purpose of post back is to display/check the[/color][/color][/color]
checkbox[color=blue][color=green]
> > ,[color=darkred]
> > > > > probabaly a better approach is to do the display/check in the[/color][/color][/color]
client[color=blue][color=green]
> > side[color=darkred]
> > > > > javascript ..
> > > > >
> > > > > Instead of settign Visibility=False, you would just add an[/color][/color][/color]
attribute[color=blue][color=green]
> > to[color=darkred]
> > > > > 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.[/color][/color][/color]
But[color=blue][color=green]
> > if[color=darkred]
> > > > the
> > > > > > user swipes the card, I want to fill out the fields[/color][/color][/color]
automatically[color=blue][color=green]
> > and[color=darkred]
> > > > make
> > > > > > them read only. (So far I can do this.)
> > > > > >
> > > > > > But I also want a checkbox to appear that indicates the card was[/color]
> > swiped.[color=darkred]
> > > > > > The user can clear the checkbox, re-enabling the fields so they[/color][/color][/color]
can[color=blue][color=green]
> > be[color=darkred]
> > > > > > edited, but then I will no longer consider the data as being[/color][/color][/color]
swiped.[color=blue][color=green]
> > I[color=darkred]
> > > > want
> > > > > > the check box to disappear if they clear it.
> > > > > >
> > > > > > Using server controls, if I create a checkbox, but make it not[/color]
> > visible,[color=darkred]
> > > > then
> > > > > > it's not available at the client side to work with from client[/color][/color][/color]
side[color=blue][color=green][color=darkred]
> > > > code.
> > > > > > So I would need to send some flag back to the server to indicate[/color][/color][/color]
a[color=blue][color=green]
> > post[color=darkred]
> > > > back
> > > > > > and have the page re-rendered properly. But how do send info to[/color][/color][/color]
the[color=blue][color=green][color=darkred]
> > > > server
> > > > > > like that without having a visible control to attach the data[/color][/color][/color]
to?[color=blue][color=green][color=darkred]
> > > > > >
> > > > > > (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[/color][/color][/color]
postback,[color=blue][color=green]
> > where[color=darkred]
> > > > the
> > > > > > data is not a property of a server control that's tracking[/color]
> > viewstate?[color=darkred]
> > > > The
> > > > > > session object is only available on the server side right?
> > > > > >
> > > > > > Any guidance here is appreciated. Thanks.
> > > > > >
> > > > > > Jerry
> > > > > >
> > > > > >
> > > > > >
> > > >
> > > >
> > > >[/color]
> >
> >
> >[/color][/color]


Closed Thread