Javascript function with value of server-side event

Javascript function with value of server-side event

am 20.12.2007 07:22:56 von timor.super

Hi group,

what I would like to do is maybe a little hard and I can't achieve to
make it. So I need your help to go in the right way.

What I want is to create a webcontrol that can use one its properties
value , set with the server-sider onclick event, with client
javascript.

Something like this :

(default.apsx)
OnServerClick="ClickEvent"/>

(default.apsx.cs)
protected override void ClickEvent(EventArgs e)
{
testControl.myProperty = "my value";
}

an when I click on the control, i have a javascript function that
alert the myProperty value.

I know how to set a serverClick event, with IPostBackEventHandler ...

I think I have to deal with ICallbackEventHandler but the alert
javascript function comes too earl and can't know the value of
myProperty, and I don't want the page to be postbacked entirely
because alert function has to come just on the clientclick.
Maybe the good solution is to make something like an autopostback =
true, but I don't know how to make it.

How would you do something like that ?

Thanks for your help.

T.

Re: Javascript function with value of server-side event

am 23.12.2007 04:07:20 von nothingsoriginalontheinternet

On Dec 20, 1:22 am, timor.su...@gmail.com wrote:
> (default.apsx.cs)
> protected override void ClickEvent(EventArgs e)
> {
> testControl.myProperty = "my value";
> }
>
> an when I click on the control, i have a javascript function that
> alert the myProperty value.

You can do that with AJAX. ASP.net has AJAX stuff available here so
you don't have to learn the low level JavaScript stuff like we use
when we aren't using a framework:

http://www.asp.net/ajax/

-Michael Placentra II