Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts

Saturday, March 31, 2012

Server Side Code dependent on JavaScript

Is there a way I can launch a Server Side function from JavaScript?

On a Button Click, I am using JavaScript to print to current page. When the print has been sent, I want to run a Server Side Function to update a record (which also changes the screen so I have to wait until it prints to run the server side function).

Thanks.I imagine in your JS function, you could print and then do a postback to the server?
This may get your problem resolved.

private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
Button1.Attributes.Add("onClick","javascript:DoSomething();");
string html = "";
html += "<script>";
html += " function DoSomething()";
html += " {";
html += " window.print();";
html += " }";
html += "</script>";
Response.Write(html);
}

private void Button1_Click(object sender, System.EventArgs e)
{
Update();
}

public void Update()
{
Response.Write("Now going to update the record.");
}
How to force a postback using javascript:

http://weblogs.asp.net/mnolton/archive/2003/06/04/8260.aspx

server side code access the text of <asp:label> changed by client-side javascript co

Is possible for server side code to access the text of <asp:label> changed
by client side javascript code?Yes, of course you can do it.

--
-Saravana
http://dotnetjunkies.com/WebLog/saravana/
www.ExtremeExperts.com

"nick" <nbdy9.removethis@.hotmail.com> wrote in message
news:%23UAnyAt4EHA.2600@.TK2MSFTNGP09.phx.gbl...
> Is possible for server side code to access the text of <asp:label> changed
> by client side javascript code?
No, you will need to double the new value into a hidden text field, or some
other postable field, and then look for the change of the text through the
Request.Forms["txtHidden1"] property on postback to determine if the text
has changed.

bill

"nick" <nbdy9.removethis@.hotmail.com> wrote in message
news:%23UAnyAt4EHA.2600@.TK2MSFTNGP09.phx.gbl...
> Is possible for server side code to access the text of <asp:label> changed
> by client side javascript code?
If you mean accessing the text via the label's Text property, the answer is
no.

You can pass the changed text to the server in one of the common ways of
passing values from client to server, for example in a hidden field.

Eliyahu

"nick" <nbdy9.removethis@.hotmail.com> wrote in message
news:%23UAnyAt4EHA.2600@.TK2MSFTNGP09.phx.gbl...
> Is possible for server side code to access the text of <asp:label> changed
> by client side javascript code?

server side code access the text of <asp:label> changed by client-side javascri

Is possible for server side code to access the text of <asp:label> changed
by client side javascript code?Yes, of course you can do it.
-Saravana
http://dotnetjunkies.com/WebLog/saravana/
www.ExtremeExperts.com
"nick" <nbdy9.removethis@.hotmail.com> wrote in message
news:%23UAnyAt4EHA.2600@.TK2MSFTNGP09.phx.gbl...
> Is possible for server side code to access the text of <asp:label> changed
> by client side javascript code?
>
No, you will need to double the new value into a hidden text field, or some
other postable field, and then look for the change of the text through the
Request.Forms["txtHidden1"] property on postback to determine if the text
has changed.
bill
"nick" <nbdy9.removethis@.hotmail.com> wrote in message
news:%23UAnyAt4EHA.2600@.TK2MSFTNGP09.phx.gbl...
> Is possible for server side code to access the text of <asp:label> changed
> by client side javascript code?
>
If you mean accessing the text via the label's Text property, the answer is
no.
You can pass the changed text to the server in one of the common ways of
passing values from client to server, for example in a hidden field.
Eliyahu
"nick" <nbdy9.removethis@.hotmail.com> wrote in message
news:%23UAnyAt4EHA.2600@.TK2MSFTNGP09.phx.gbl...
> Is possible for server side code to access the text of <asp:label> changed
> by client side javascript code?
>

Server side control that maintains viewstate for client-side javascript variables?

I have some client-side javascript for that I use for dhtml stuff such as
hiding div tags based on user menu selections, etc. I need a way to maintain
the state of javascript variables across postback. Are there any server side
controls that can be used as a container for client-side javascript
variables? If not, how do other developers approach this issue?

Thanks,

Keihtjust use hidden fields

-- bruce (sqlwork.com)

Keithb wrote:

Quote:

Originally Posted by

I have some client-side javascript for that I use for dhtml stuff such as
hiding div tags based on user menu selections, etc. I need a way to maintain
the state of javascript variables across postback. Are there any server side
controls that can be used as a container for client-side javascript
variables? If not, how do other developers approach this issue?
>
Thanks,
>
Keiht
>
>

server side controls disabled in javascript

I have a requirement to disable some textboxs depending on their
contents. I choose to do this by invoking some javascript. When they
change the contents, i disable the textbox they just put new data into
and focus on another textbox.
My logic works fine, the textboxes get disabled.
However, when the page posts back, the disabled textbox contents (which
were changed before disabling) DOES NOT GO BACK TO THE SERVER. The
server gets the old value instead. I have found some references to this
but I would like to hear some other peoples experences with this. Is it
solveable?
I can solve this by using the Vb.net enable property instead but it
requires a postback which i trying to advoide.
A related queston. VB.net textboxs have their own enable property. The
dom object has it's disabled property. It's the dom object disabled
propety that is causing this behavior. So the quesiton is, can i set
the vb.net textbox.enable property instead of the dom object's version
from Javascript? This would also solve my problem.> However, when the page posts back, the disabled textbox contents
> (which
> were changed before disabling) DOES NOT GO BACK TO THE SERVER. The
> server gets the old value instead. I have found some references to
> this
> but I would like to hear some other peoples experences with this. Is
> it
> solveable?
This is because ASP.NET is a server side technology and every request tot
he server recreates the page and all the controls on the page. Anything you'
ve
done in the browser in javascript is not known to the server. You can make
this work, but nothing's built in to do this, so i'll be manual. To make
it work you just need to convey the right information to the server and then
write the cde to enable/disable those controls based upon the info you've
sent to the server.

> dom object has it's disabled property. It's the dom object disabled
> propety that is causing this behavior. So the quesiton is, can i set
> the vb.net textbox.enable property instead of the dom object's version
> from Javascript? This would also solve my problem.
Yes, you can set that property on the server side control and when it render
s
it will emit the right style to make it disabled in the browser. But again,
if you change that value in the browser, you'll have to somehow let the serv
er
know the next time you do a postback so you can keep the client enabled/disa
bled
state in synch with the server side enabled/disable state.
-Brock
DevelopMentor
http://staff.develop.com/ballen
Thank you very much for responding so quickly. I'm not sure you
answered the question. The problem is with the contents of a control
that was changed then disabled with javascript. On sumit Its contents
are not going back to the server because it's disabled.
And again that you so much for the quick response.
Also, how would you set the textbox.enable=false from javascript?
Remember not the dom.disabled but the vb.net textbox.enable property.
How about enabling the text boxes just before submit by also using Java
script. Add a handler to the Form's onsubmit, in the HTML view add something
like this to the form:
<form onsubmit="EnableBoxes();" id="Form1" ....
Then in the function EnableBoxes you enable the boxes that were disabled.
Your function will run before the submit and results will be as expected.
"CsaaGuy" <ross_smith@.csaa.com> wrote in message
news:1131812935.305878.50570@.z14g2000cwz.googlegroups.com...
>I have a requirement to disable some textboxs depending on their
> contents. I choose to do this by invoking some javascript. When they
> change the contents, i disable the textbox they just put new data into
> and focus on another textbox.
> My logic works fine, the textboxes get disabled.
> However, when the page posts back, the disabled textbox contents (which
> were changed before disabling) DOES NOT GO BACK TO THE SERVER. The
> server gets the old value instead. I have found some references to this
> but I would like to hear some other peoples experences with this. Is it
> solveable?
> I can solve this by using the Vb.net enable property instead but it
> requires a postback which i trying to advoide.
> A related queston. VB.net textboxs have their own enable property. The
> dom object has it's disabled property. It's the dom object disabled
> propety that is causing this behavior. So the quesiton is, can i set
> the vb.net textbox.enable property instead of the dom object's version
> from Javascript? This would also solve my problem.
>
Ah, I see what you're saying. Well, it seems you're running into a browser
or HTML issue. Controls that are disabled simply aren't posted to the server
.
I don't know if that's specific to the HTML, but it seems to be the case
for both Firefox and IE.
-Brock
DevelopMentor
http://staff.develop.com/ballen

> Thank you very much for responding so quickly. I'm not sure you
> answered the question. The problem is with the contents of a control
> that was changed then disabled with javascript. On sumit Its contents
> are not going back to the server because it's disabled.
> And again that you so much for the quick response.
>
Cool, that worked. Its a kludge but it works! Thanks. My other life
intruded so sorry for the delay. By the way, Is there a way to set the
<asp:TextBox>'s version enabled property from Javascript? Microsoft
worked around this problem by not using the DOM disabled property. They
cheated somehow.
Thanks again.
Actually <asp:TextBox> is something that lives only on the server, the stuff
that reaches your browser is HTML, so on the server when rendering, the
output of the MS Controls are converted to their HTML buddies. Do a "View
Source" on the browser to see what the MS control looks like in the browser.
So the answer is no, you can't use Java script to access the MS text box,
because Java script can only access stuff that is in the browser.
"CsaaGuy" <ross_smith@.csaa.com> wrote in message
news:1131825477.222621.257870@.o13g2000cwo.googlegroups.com...
> Cool, that worked. Its a kludge but it works! Thanks. My other life
> intruded so sorry for the delay. By the way, Is there a way to set the
> <asp:TextBox>'s version enabled property from Javascript? Microsoft
> worked around this problem by not using the DOM disabled property. They
> cheated somehow.
> Thanks again.
>
Another approach is to make the textbox read-only and change it's class
to one that makes it appear as if its disabled.

server side controls disabled in javascript

I have a requirement to disable some textboxs depending on their
contents. I choose to do this by invoking some javascript. When they
change the contents, i disable the textbox they just put new data into
and focus on another textbox.

My logic works fine, the textboxes get disabled.

However, when the page posts back, the disabled textbox contents (which
were changed before disabling) DOES NOT GO BACK TO THE SERVER. The
server gets the old value instead. I have found some references to this
but I would like to hear some other peoples experences with this. Is it
solveable?
I can solve this by using the Vb.net enable property instead but it
requires a postback which i trying to advoide.

A related queston. VB.net textboxs have their own enable property. The
dom object has it's disabled property. It's the dom object disabled
propety that is causing this behavior. So the quesiton is, can i set
the vb.net textbox.enable property instead of the dom object's version
from Javascript? This would also solve my problem.> However, when the page posts back, the disabled textbox contents
> (which
> were changed before disabling) DOES NOT GO BACK TO THE SERVER. The
> server gets the old value instead. I have found some references to
> this
> but I would like to hear some other peoples experences with this. Is
> it
> solveable?

This is because ASP.NET is a server side technology and every request tot
he server recreates the page and all the controls on the page. Anything you've
done in the browser in javascript is not known to the server. You can make
this work, but nothing's built in to do this, so i'll be manual. To make
it work you just need to convey the right information to the server and then
write the cde to enable/disable those controls based upon the info you've
sent to the server.

> dom object has it's disabled property. It's the dom object disabled
> propety that is causing this behavior. So the quesiton is, can i set
> the vb.net textbox.enable property instead of the dom object's version
> from Javascript? This would also solve my problem.

Yes, you can set that property on the server side control and when it renders
it will emit the right style to make it disabled in the browser. But again,
if you change that value in the browser, you'll have to somehow let the server
know the next time you do a postback so you can keep the client enabled/disabled
state in synch with the server side enabled/disable state.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Thank you very much for responding so quickly. I'm not sure you
answered the question. The problem is with the contents of a control
that was changed then disabled with javascript. On sumit Its contents
are not going back to the server because it's disabled.

And again that you so much for the quick response.
Also, how would you set the textbox.enable=false from javascript?
Remember not the dom.disabled but the vb.net textbox.enable property.
How about enabling the text boxes just before submit by also using Java
script. Add a handler to the Form's onsubmit, in the HTML view add something
like this to the form:
<form onsubmit="EnableBoxes();" id="Form1" ....
Then in the function EnableBoxes you enable the boxes that were disabled.
Your function will run before the submit and results will be as expected.

"CsaaGuy" <ross_smith@.csaa.com> wrote in message
news:1131812935.305878.50570@.z14g2000cwz.googlegro ups.com...
>I have a requirement to disable some textboxs depending on their
> contents. I choose to do this by invoking some javascript. When they
> change the contents, i disable the textbox they just put new data into
> and focus on another textbox.
> My logic works fine, the textboxes get disabled.
> However, when the page posts back, the disabled textbox contents (which
> were changed before disabling) DOES NOT GO BACK TO THE SERVER. The
> server gets the old value instead. I have found some references to this
> but I would like to hear some other peoples experences with this. Is it
> solveable?
> I can solve this by using the Vb.net enable property instead but it
> requires a postback which i trying to advoide.
> A related queston. VB.net textboxs have their own enable property. The
> dom object has it's disabled property. It's the dom object disabled
> propety that is causing this behavior. So the quesiton is, can i set
> the vb.net textbox.enable property instead of the dom object's version
> from Javascript? This would also solve my problem.
Ah, I see what you're saying. Well, it seems you're running into a browser
or HTML issue. Controls that are disabled simply aren't posted to the server.
I don't know if that's specific to the HTML, but it seems to be the case
for both Firefox and IE.

-Brock
DevelopMentor
http://staff.develop.com/ballen

> Thank you very much for responding so quickly. I'm not sure you
> answered the question. The problem is with the contents of a control
> that was changed then disabled with javascript. On sumit Its contents
> are not going back to the server because it's disabled.
> And again that you so much for the quick response.
Cool, that worked. Its a kludge but it works! Thanks. My other life
intruded so sorry for the delay. By the way, Is there a way to set the
<asp:TextBox>'s version enabled property from Javascript? Microsoft
worked around this problem by not using the DOM disabled property. They
cheated somehow.

Thanks again.
Actually <asp:TextBox> is something that lives only on the server, the stuff
that reaches your browser is HTML, so on the server when rendering, the
output of the MS Controls are converted to their HTML buddies. Do a "View
Source" on the browser to see what the MS control looks like in the browser.
So the answer is no, you can't use Java script to access the MS text box,
because Java script can only access stuff that is in the browser.

"CsaaGuy" <ross_smith@.csaa.com> wrote in message
news:1131825477.222621.257870@.o13g2000cwo.googlegr oups.com...
> Cool, that worked. Its a kludge but it works! Thanks. My other life
> intruded so sorry for the delay. By the way, Is there a way to set the
> <asp:TextBox>'s version enabled property from Javascript? Microsoft
> worked around this problem by not using the DOM disabled property. They
> cheated somehow.
> Thanks again.
Another approach is to make the textbox read-only and change it's class
to one that makes it appear as if its disabled.

server side javascript array

I am trying to load an array on the load of a page to javascript. the
script will eventually have parts being loaded from a database... this is
just a first step to get there... Here is the code
Dim mScript As New System.Text.StringBuilder
mScript = mScript.Append("<script type='text/javascript'>" & vbNewLine)
mScript.Append("var mIconAry = new Array();" & vbNewLine)
mScript.Append("mIconAry[" & 0 & "]='" &
"http://maps.google.com/mapfiles/ms/icons/purple-pushpin.png" & "';" &
vbNewLine)
mScript.Append("mIconAry[" & 1 & "]='" &
"http://maps.google.com/mapfiles/ms/icons/green-pushpin.png" & "';" &
vbNewLine)
'mScript.Append("var mInfoBox = new Array();" & vbNewLine)
'mscript.Append("mInfoBox[" & 0 & "]='" &
mScript.Append("</script>")
RegisterStartupScript("RegisterClientScriptBlock", mScript.ToString())
when i run this.. the javascript isn't there. I've tried looking using
firefox and a plugin that allows you to see all the javascript and it's not
there.. i'm using the same technique as i've used on another page and it
works there.. i don't think i've left anything out.
I'd like to use this array to put pushpins onto a microsoft virutal earth
map that i'm using. anyway.. anyone have any idea's what i'm doing wrong
in my code above.
thanks
shannonWhy don't you use the RegisterArrayDeclaration method?
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"jvcoach23" <shannonr@.sucss.state.il.us> wrote in message
news:1383ly3ijx2rg$.s770m2o8r3kg$.dlg@.40tude.net...
>I am trying to load an array on the load of a page to javascript. the
> script will eventually have parts being loaded from a database... this is
> just a first step to get there... Here is the code
> Dim mScript As New System.Text.StringBuilder
> mScript = mScript.Append("<script type='text/javascript'>" & vbNewLine)
> mScript.Append("var mIconAry = new Array();" & vbNewLine)
> mScript.Append("mIconAry[" & 0 & "]='" &
> "http://maps.google.com/mapfiles/ms/icons/purple-pushpin.png" & "';" &
> vbNewLine)
> mScript.Append("mIconAry[" & 1 & "]='" &
> "http://maps.google.com/mapfiles/ms/icons/green-pushpin.png" & "';" &
> vbNewLine)
> 'mScript.Append("var mInfoBox = new Array();" & vbNewLine)
> 'mscript.Append("mInfoBox[" & 0 & "]='" &
> mScript.Append("</script>")
> RegisterStartupScript("RegisterClientScriptBlock", mScript.ToString())
> when i run this.. the javascript isn't there. I've tried looking using
> firefox and a plugin that allows you to see all the javascript and it's
> not
> there.. i'm using the same technique as i've used on another page and it
> works there.. i don't think i've left anything out.
> I'd like to use this array to put pushpins onto a microsoft virutal earth
> map that i'm using. anyway.. anyone have any idea's what i'm doing wrong
> in my code above.
> thanks
> shannon
Thanks
in doing a little searching... i see this
RegisterArrayDeclaration("TextBoxes","TextBox1")
RegisterArrayDeclaration("TextBoxes", "TextBox2")
and they say that it will produce
<script language="javascript" >
<!--
var TextBoxes = new Array(TextBox1, TextBox2);
// -->
</script>
is it as simple as that to get the array in there... i've tried it.. the
array is not showing up in the javascript.. so i'm just curious if what
i've read is incorrect.
thanks
I added the ClientScript.RegisterArrayDeclaration("mIconAry",
"http://maps.google.com/mapfiles/ms/icons/purple-pushpin.png")
to another page.. and when the page renders.. it puts the array in
var mIconAry = new
Array(http://maps.google.com/mapfiles/ms/...ple-pushpin.png);
but when i try it on a different page, within the same project... on the
page with the microsoft map... it doesn't show up...
hope that is helpful
shannon
the non-woprking page probably does a redirect, so none of its html is of an
y
use.
-- bruce (sqlwork.com)
"jvcoach23" wrote:

> I added the ClientScript.RegisterArrayDeclaration("mIconAry",
> "http://maps.google.com/mapfiles/ms/icons/purple-pushpin.png")
> to another page.. and when the page renders.. it puts the array in
> var mIconAry = new
> Array(http://maps.google.com/mapfiles/ms/...ple-pushpin.png);
> but when i try it on a different page, within the same project... on the
> page with the microsoft map... it doesn't show up...
> hope that is helpful
> shannon
>
Found the problem... the line needed to read
ClientScript.RegisterArrayDeclaration("mIconAry",
"'http://maps.google.com/mapfiles/ms/icons/purple-pushpin.png'")
I needed the single ' inside of the double "
thanks
shannon

Thursday, March 29, 2012

Server side live clock

I know that we can build a live clock in the web form using Javascript. But i understand that the clock is refer to the user system clock..

May I build a live clock that the time is refer to the server clock?

Can ASP do it like tat?Get the server clock in a javascript variable on the page and then increase this each second. You then have a live clock but with the server hour.

Tip : use the javascript clock but initialize it with the time value you got from server.
Okok.. I got your idea. Thanks alot.

Server Side Notifications and a Javascript Application...

Hello Everyone,
I'm building an application which requires server side events to be pushed
to clients.
Typically I build these applications with a think client, but the machines
I'm deploying this particular application have a very slim image - no .NET,
Java, or any other runtimes.
I am only able to use Internet Explorer 6.0 (running on Windows 2000 Pro).
I've implemented a solution using web services, a polling mechanism, and
ASP.NET AJAX ... however this method takes up a lot of CPU cycles on the
client which is noticable since javascript is single-threaded. I am polling
the server every second.
I understand there is an up and coming framework called COMET which does
provide server side event pushed through a persistent connection, but does
anyone know how easy it would be to integrate this pattern into ASP.NET
Ajax?
I'm just throwing this out to see how other people have built applications
which require a server side event push.
Thanks!hi at matlus dot com there's "always connected" http thingey written
in delphi. client is always connected. i wonder if it helps to achieve
what u want
On Nov 30, 1:17 pm, Spam Catcher <spamhoney...@.rogers.com> wrote:
> Hello Everyone,
> I'm building an application which requires server side events to be pushed
> to clients.
> Typically I build these applications with a think client, but the machines
> I'm deploying this particular application have a very slim image - no .NET
,
> Java, or any other runtimes.
> I am only able to use Internet Explorer 6.0 (running on Windows 2000 Pro).
> I've implemented a solution using web services, a polling mechanism, and
> ASP.NET AJAX ... however this method takes up a lot of CPU cycles on the
> client which is noticable since javascript is single-threaded. I am pollin
g
> the server every second.
> I understand there is an up and coming framework called COMET which does
> provide server side event pushed through a persistent connection, but does
> anyone know how easy it would be to integrate this pattern into ASP.NET
> Ajax?
> I'm just throwing this out to see how other people have built applications
> which require a server side event push.
> Thanks!
comet uses what used to be called server push. basically the browser
does a request usually to a iframe. the server keeps the connection open
for a limited time, say a minute and pushes javascript events via
script. you want to reload to free memory in the browser and to prevent
timeouts.
<iframe src="http://pics.10026.com/?src=push.aspx">
push logic
Response Buffer Off
Response.Write("<script>")
loop
wait on event
if (timeout)
Response.Write("document.location.href = 'push.aspx'")
Response.End()
else
Write event javascript
Response.Flush()
end loop
-- bruce (sqlwork.com)
Spam Catcher wrote:
> Hello Everyone,
> I'm building an application which requires server side events to be pushed
> to clients.
> Typically I build these applications with a think client, but the machines
> I'm deploying this particular application have a very slim image - no .NET
,
> Java, or any other runtimes.
> I am only able to use Internet Explorer 6.0 (running on Windows 2000 Pro).
> I've implemented a solution using web services, a polling mechanism, and
> ASP.NET AJAX ... however this method takes up a lot of CPU cycles on the
> client which is noticable since javascript is single-threaded. I am pollin
g
> the server every second.
> I understand there is an up and coming framework called COMET which does
> provide server side event pushed through a persistent connection, but does
> anyone know how easy it would be to integrate this pattern into ASP.NET
> Ajax?
> I'm just throwing this out to see how other people have built applications
> which require a server side event push.
> Thanks!

Server Side Notifications and a Javascript Application...

Hello Everyone,

I'm building an application which requires server side events to be pushed
to clients.

Typically I build these applications with a think client, but the machines
I'm deploying this particular application have a very slim image - no .NET,
Java, or any other runtimes.

I am only able to use Internet Explorer 6.0 (running on Windows 2000 Pro).

I've implemented a solution using web services, a polling mechanism, and
ASP.NET AJAX ... however this method takes up a lot of CPU cycles on the
client which is noticable since javascript is single-threaded. I am polling
the server every second.

I understand there is an up and coming framework called COMET which does
provide server side event pushed through a persistent connection, but does
anyone know how easy it would be to integrate this pattern into ASP.NET
Ajax?

I'm just throwing this out to see how other people have built applications
which require a server side event push.

Thanks!hi at matlus dot com there's "always connected" http thingey written
in delphi. client is always connected. i wonder if it helps to achieve
what u want

On Nov 30, 1:17 pm, Spam Catcher <spamhoney...@.rogers.comwrote:

Quote:

Originally Posted by

Hello Everyone,
>
I'm building an application which requires server side events to be pushed
to clients.
>
Typically I build these applications with a think client, but the machines
I'm deploying this particular application have a very slim image - no .NET,
Java, or any other runtimes.
>
I am only able to use Internet Explorer 6.0 (running on Windows 2000 Pro).
>
I've implemented a solution using web services, a polling mechanism, and
ASP.NET AJAX ... however this method takes up a lot of CPU cycles on the
client which is noticable since javascript is single-threaded. I am polling
the server every second.
>
I understand there is an up and coming framework called COMET which does
provide server side event pushed through a persistent connection, but does
anyone know how easy it would be to integrate this pattern into ASP.NET
Ajax?
>
I'm just throwing this out to see how other people have built applications
which require a server side event push.
>
Thanks!

Server side operation from javascript

Hi
I want to do some server side operation on close of a browser. I created
a server side html button and invoked a post back event on close of
browser something like
__doPostBack('btnUnlock',''); What I realised this is unreliable as the
operation is yet not completed when the browser has closed and
essentially the thread would have been killed. Is there any way in
javascript wherein I post a message to the server, wait for the response
and then the window closes something like send message and wait for the
response.
Regards
RJN
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!RJN <rjn@.yahoo.com> wrote in news:#uju2BxoEHA.556@.tk2msftngp13.phx.gbl:

> Is there any way in
> javascript wherein I post a message to the server, wait for the response
> and then the window closes something like send message and wait for the
> response.
>
There is no way to ensure this will fire. Client side javascript can be
disabled or stopped in many ways.
Instead, use the Session End event handler in the Global.asax.
Lucas Tam (REMOVEnntp@.rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
[url]http://members.ebay.com/aboutme/spot18/[/url]
Yes, there is a very simple way. Post your message (it doesn't have to be
hacker style _doPostBack, it can be any value passed to the server in one of
legal and documented ways) and, in the response, get server-side to emit
window.close() javascript statement.
Eliyahu
"RJN" <rjn@.yahoo.com> wrote in message
news:%23uju2BxoEHA.556@.tk2msftngp13.phx.gbl...
> Hi
> I want to do some server side operation on close of a browser. I created
> a server side html button and invoked a post back event on close of
> browser something like
> __doPostBack('btnUnlock',''); What I realised this is unreliable as the
> operation is yet not completed when the browser has closed and
> essentially the thread would have been killed. Is there any way in
> javascript wherein I post a message to the server, wait for the response
> and then the window closes something like send message and wait for the
> response.
> Regards
> RJN
>
> *** Sent via Developersdex http://www.examnotes.net ***
> Don't just participate in USENET...get rewarded for it!

Server side operation from javascript

Hi

I want to do some server side operation on close of a browser. I created
a server side html button and invoked a post back event on close of
browser something like
__doPostBack('btnUnlock',''); What I realised this is unreliable as the
operation is yet not completed when the browser has closed and
essentially the thread would have been killed. Is there any way in
javascript wherein I post a message to the server, wait for the response
and then the window closes something like send message and wait for the
response.

Regards

RJN

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!RJN <rjn@.yahoo.com> wrote in news:#uju2BxoEHA.556@.tk2msftngp13.phx.gbl:

> Is there any way in
> javascript wherein I post a message to the server, wait for the response
> and then the window closes something like send message and wait for the
> response.

There is no way to ensure this will fire. Client side javascript can be
disabled or stopped in many ways.

Instead, use the Session End event handler in the Global.asax.

--
Lucas Tam (REMOVEnntp@.rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Yes, there is a very simple way. Post your message (it doesn't have to be
hacker style _doPostBack, it can be any value passed to the server in one of
legal and documented ways) and, in the response, get server-side to emit
window.close() javascript statement.

Eliyahu

"RJN" <rjn@.yahoo.com> wrote in message
news:%23uju2BxoEHA.556@.tk2msftngp13.phx.gbl...
> Hi
> I want to do some server side operation on close of a browser. I created
> a server side html button and invoked a post back event on close of
> browser something like
> __doPostBack('btnUnlock',''); What I realised this is unreliable as the
> operation is yet not completed when the browser has closed and
> essentially the thread would have been killed. Is there any way in
> javascript wherein I post a message to the server, wait for the response
> and then the window closes something like send message and wait for the
> response.
> Regards
> RJN
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!

Server Side Set Focux

I've been researching on how to set focus to a WebControl, and the only results I'm coming across are using JavaScript. I was curious if there was a way to code this on the serverside codebehind (I am using VB) file.
The reason I ask is because I have two DropDownLists, when one is changed, the second is populated from a database based off of what the first one's value is. In the OnSelectedIndexChange event I have set up already, it would be really easy to put at the bottom of this method a DropDownList.setFocus(), but I don't seem to find that method available to the DropDownLists.
Is this is a feature that hasn't been implemented yet, or is there not a way to do this currently in the code behind and only with JavaScript?

DSimmonRemember that your web form is generating HTML and sometimes javascript to the browser to tell it what to show. HTML doesn't have a focus concept. So you are left with javascript. It is easy to set focus by writing code on the server side that generates the precise javascript.

Page.RegisterStartupScript("focus", "<script language='javascript'>document.all['" + DropDownList1.ClientID + "'].setFocus();</script>)
Here is a good solutionview post 821121

regards

Server Side Validation

Hi, i was wondering if asp.net validation controls validate on the server. I did a test turning off javascript and i got an error on my page which indicates to me that the server side validation did not take place. If the validation controls allow for server side validation then how do i enable it?

Appreciate your help.

Thanks

Yes, they validate on the server. Add a test for Page.IsValid is true in your post back event handler method (such as the Click method of a button). See this article for an example and many other common validation questions:http://aspalliance.com/699.