# Javascript and Postback persistance

**URL:** <https://community.thinkgeo.com/t/javascript-and-postback-persistance/4931>\
**Category:** WebForms\
**Created:** [August 13, 2009, 7:59am UTC](https://community.thinkgeo.com/t/javascript-and-postback-persistance/4931 "2009-08-13T07:59:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexandre1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/a/f475e1/32.png) [@Alexandre1](https://community.thinkgeo.com/u/Alexandre1)\
**Post date:** [August 13, 2009, 7:59am UTC](https://community.thinkgeo.com/t/javascript-and-postback-persistance/4931/1 "2009-08-13T07:59:01Z")

</div>

Hello,

I&nbsp;use&nbsp;a&nbsp;lot&nbsp;javascript&nbsp;API&nbsp;on&nbsp;MapSuite&nbsp;but&nbsp;I&nbsp;have&nbsp;a&nbsp;problem&nbsp;when&nbsp;I&nbsp;do&nbsp;an&nbsp;asyncPostback.&nbsp;In&nbsp;my&nbsp;code&nbsp;behind,&nbsp;the&nbsp;state&nbsp;of&nbsp;the&nbsp;Map&nbsp;(TrackMode,&nbsp;CurrentOverlay&nbsp;...)&nbsp;seems&nbsp;not&nbsp;to&nbsp;be&nbsp;updated&nbsp;according&nbsp;to&nbsp;javascript&nbsp;changes.

the&nbsp;Map&nbsp;and&nbsp;the&nbsp;control&nbsp;buttons&nbsp;are&nbsp;not&nbsp;in&nbsp;the&nbsp;same&nbsp;update&nbsp;panel.

Example&nbsp;:&nbsp;User&nbsp;click&nbsp;on&nbsp;a&nbsp;button&nbsp;that&nbsp;put&nbsp;the&nbsp;trackmode&nbsp;from&nbsp;None&nbsp;To&nbsp;Edit.&nbsp;When&nbsp;I&nbsp;do&nbsp;a&nbsp;AsyncPostback&nbsp;from&nbsp;the&nbsp;control&nbsp;buttons's&nbsp;Update&nbsp;Panel,&nbsp;Map1.EditOverlay.TrackMode&nbsp;is&nbsp;still&nbsp;at&nbsp;None.

To&nbsp;avoid&nbsp;that,&nbsp;i&nbsp;do&nbsp;all&nbsp;my&nbsp;TrackMode&nbsp;change&nbsp;in&nbsp;code&nbsp;behind&nbsp;but&nbsp;the&nbsp;user&nbsp;experience&nbsp;is&nbsp;quitte&nbsp;disapointing.

I&nbsp;would&nbsp;like&nbsp;to&nbsp;know&nbsp;if&nbsp;there&nbsp;is&nbsp;a&nbsp;way&nbsp;to&nbsp;make&nbsp;Javascript&nbsp;API&nbsp;and&nbsp;Code&nbsp;Behind&nbsp;synchronized?&nbsp;Is&nbsp;the&nbsp;two&nbsp;UpdatePanel&nbsp;is&nbsp;the&nbsp;problem?

---

<div class="post-metadata">

**Author:** ![Howard](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/h/90ced4/32.png) [@Howard](https://community.thinkgeo.com/u/Howard)\
**Post date:** [August 13, 2009, 4:59pm UTC](https://community.thinkgeo.com/t/javascript-and-postback-persistance/4931/2 "2009-08-13T16:59:03Z")

</div>

Alexandre,&nbsp;  
&nbsp;&nbsp;  
&nbsp;You&nbsp;are&nbsp;right.&nbsp;We&nbsp;only&nbsp;synchronize&nbsp;some&nbsp;critical&nbsp;properties&nbsp;in&nbsp;our&nbsp;web&nbsp;edition.&nbsp;The&nbsp;draw&nbsp;mode&nbsp;is&nbsp;not&nbsp;include&nbsp;in&nbsp;it.&nbsp;After&nbsp;post&nbsp;back,&nbsp;the&nbsp;client&nbsp;states&nbsp;lost.&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;have&nbsp;a&nbsp;workaround&nbsp;for&nbsp;you.&nbsp;  
&nbsp;1,&nbsp;Add&nbsp;a&nbsp;hidden&nbsp;field&nbsp;which&nbsp;is&nbsp;run&nbsp;at&nbsp;server&nbsp;on&nbsp;your&nbsp;aspx&nbsp;page.&nbsp;  
&nbsp;2,&nbsp;Whenever&nbsp;the&nbsp;map&nbsp;mode&nbsp;changed,&nbsp;save&nbsp;it&nbsp;in&nbsp;the&nbsp;hidden&nbsp;field.&nbsp;  
&nbsp;3,&nbsp;After&nbsp;async&nbsp;post&nbsp;back&nbsp;in&nbsp;the&nbsp;PageLoad&nbsp;method,&nbsp;you&nbsp;can&nbsp;get&nbsp;the&nbsp;string&nbsp;which&nbsp;saved&nbsp;in&nbsp;the&nbsp;hidden&nbsp;field&nbsp;by&nbsp;its&nbsp;Id.&nbsp;  
&nbsp;4,&nbsp;Reflect&nbsp;the&nbsp;string&nbsp;to&nbsp;the&nbsp;map&nbsp;mode&nbsp;and&nbsp;reset&nbsp;to&nbsp;map.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Hope&nbsp;it&nbsp;helps.&nbsp;Any&nbsp;questions&nbsp;please&nbsp;let&nbsp;me&nbsp;know.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks,&nbsp;  
&nbsp;Howard

---

<div class="post-metadata">

**Author:** ![Alexandre1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/a/f475e1/32.png) [@Alexandre1](https://community.thinkgeo.com/u/Alexandre1)\
**Post date:** [August 14, 2009, 2:35am UTC](https://community.thinkgeo.com/t/javascript-and-postback-persistance/4931/3 "2009-08-14T02:35:43Z")

</div>

Yes&nbsp;it’s&nbsp;what&nbsp;i&nbsp;have&nbsp;done&nbsp;as&nbsp;a&nbsp;workaround&nbsp;&nbsp;The&nbsp;problem&nbsp;is&nbsp;that&nbsp;it&nbsp;redraw&nbsp;my&nbsp;backgroundoverlay&nbsp;and&nbsp;my&nbsp;shapeoverlay.&nbsp;It’s&nbsp;very&nbsp;annoying&nbsp;if&nbsp;the&nbsp;user&nbsp;naviguate&nbsp;quickly&nbsp;between&nbsp;tool.&nbsp;  
&nbsp;&nbsp;

---

<div class="post-metadata">

**Author:** ![Howard](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/h/90ced4/32.png) [@Howard](https://community.thinkgeo.com/u/Howard)\
**Post date:** [August 14, 2009, 10:02am UTC](https://community.thinkgeo.com/t/javascript-and-postback-persistance/4931/4 "2009-08-14T10:02:21Z")

</div>

Alexandre,&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;mean&nbsp;to&nbsp;set&nbsp;the&nbsp;current&nbsp;draw&nbsp;mode&nbsp;on&nbsp;the&nbsp;client&nbsp;side&nbsp;while&nbsp;you&nbsp;call&nbsp;the&nbsp;client&nbsp;method&nbsp;to&nbsp;change&nbsp;the&nbsp;track&nbsp;mode.&nbsp;When&nbsp;you&nbsp;do&nbsp;a&nbsp;post&nbsp;back,&nbsp;we&nbsp;synchronize&nbsp;the&nbsp;track&nbsp;mode&nbsp;to&nbsp;the&nbsp;server&nbsp;only&nbsp;once.&nbsp;I&nbsp;don’t&nbsp;think&nbsp;it’s&nbsp;a&nbsp;bad&nbsp;user&nbsp;experience.&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;Hope&nbsp;there&nbsp;is&nbsp;no&nbsp;misunderstanding.&nbsp;Any&nbsp;questions&nbsp;please&nbsp;let&nbsp;me&nbsp;know.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks,&nbsp;  
&nbsp;Howard
