I'm using an external javascript file. When the user postbacks the form the
script below executes. I need to assign the value to a session object. How
can i do that?
this.GetGoToPage = function(index){
var gotoPageElement = this.GetGoToPageEditorElement(index);
if(gotoPageElement != null){
var reg = /^[0-9]+$/;
if(reg.test(gotoPageElement.value))
{alert(gotoPageElement.value);
return parseInt(gotoPageElement.value) - 1;
}
else
alert("The number of page must be an integer number");
}
return NaN;
}there are really only two ways, rename your javascript file .aspx and then
you can treat it as a server-side aspx file that outputs client-side
javascirpt.
or declare a variable in your main page before you include this file,
something like:
<script language="JavaScript">
var sessionValue = '<%=(string)Session["whatever"]%>';
</script>
<script scr="...."...></script
which makes "sessionValue" a global on your page and in your script.
Karl
--
http://www.openmymind.net/
"Alper ZGR" <alpozgur@.gmail.com> wrote in message
news:urzziHFPGHA.916@.TK2MSFTNGP10.phx.gbl...
> Hi,
> I'm using an external javascript file. When the user postbacks the form
> the script below executes. I need to assign the value to a session object.
> How can i do that?
> this.GetGoToPage = function(index){
> var gotoPageElement = this.GetGoToPageEditorElement(index);
> if(gotoPageElement != null){
> var reg = /^[0-9]+$/;
> if(reg.test(gotoPageElement.value))
> {alert(gotoPageElement.value);
> return parseInt(gotoPageElement.value) - 1;
> }
> else
> alert("The number of page must be an integer number");
> }
> return NaN;
> }
Alper ZGR wrote:
> Hi,
> I'm using an external javascript file. When the user postbacks the form the
> script below executes. I need to assign the value to a session object. How
> can i do that?
Hello Alper,
One other option is to use AJAX to have the JavaScript call a
server-side script without having to refresh the page. I have an
example in PHP here:
http://www.impliedbydesign.com/supe...mming-seed.html
To see it in action, just visit the demo page. You can use that as an
example for how to get started using AJAX in an application. It should
be pretty easy for you to figure out how to use it for the application
you're working with.
Good luck!
Chris S.
Implied By Design LLC.
http://www.impliedbydesign.com
Free Web Design Tools
http://www.impliedbydesign.com/free...re-scripts.html
0 comments:
Post a Comment