A challange with client callback (2.0)
-
Hi guys, I have implemented a simple client callback functionality (which works fine), that upon clicking an html button only a portion of the page accesses database and changes a field. Then within the same javascript I have a timer go off and once 90 seconds elapses, it changes the properties of certain fields/controls on the page. Now, my challange is to access the database again once the 90 seconds has passed and change a couple of the data fields... I cannot think about a way to do this! Can somebody PLEASE PLEASE PLEASE help me? :-) Nila Fridley
-
Hi guys, I have implemented a simple client callback functionality (which works fine), that upon clicking an html button only a portion of the page accesses database and changes a field. Then within the same javascript I have a timer go off and once 90 seconds elapses, it changes the properties of certain fields/controls on the page. Now, my challange is to access the database again once the 90 seconds has passed and change a couple of the data fields... I cannot think about a way to do this! Can somebody PLEASE PLEASE PLEASE help me? :-) Nila Fridley
Hi there, IMHO, you can use the
setTimeout/setInterval
methods to implement the client side timer, then once after a specified period of time, a custom client side function is called and you can use it to update the DB with ClientCallback. You can easily find the exampples of these two functions out there. -
Hi there, IMHO, you can use the
setTimeout/setInterval
methods to implement the client side timer, then once after a specified period of time, a custom client side function is called and you can use it to update the DB with ClientCallback. You can easily find the exampples of these two functions out there.Thanks a bunch for your help, though Im still a little confused :-( I have my connection strings stored in web.config for the data access layer to deal with, and don't like the idea of accessing database directly from a javascript... I was hoping to be able to do yet another callback for that purpose(you know, like going through RaiseCallbackEvent and GetCallbackResult again). But in order to do that I had to wire that particular javascript to a specific control's Attribute collection (this.someControl.Attributes.Add("", "")... Would you happen to know of a good article or two that may shed some light? Thank you so much :-) Nila Fridley
-
Hi there, IMHO, you can use the
setTimeout/setInterval
methods to implement the client side timer, then once after a specified period of time, a custom client side function is called and you can use it to update the DB with ClientCallback. You can easily find the exampples of these two functions out there.I took your advise and looked around; after putting together parts of other people's solutions I finally was able to get it right. Turns out I had to provide yet another callbackEventReference (with a function named Release(arg, context)) that would tell my server to do something, and I called that function from within the timer function... long story short, it worked and Im super happy :-D Nila Fridley