This is a migrated thread and some comments may be shown as answers.

RadAjax? not allowing JScript to Access current value of ViewState Server Variable

1 Answer 47 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Neal
Top achievements
Rank 1
Neal asked on 16 Aug 2010, 01:58 PM
Hi All,

I need to access the current value of a Server Side variable (stored as a ViewState var) from a Java Script.
easy enough...eg

 

 

var i == <%= OGridItem_ItemIndex %>

but, If I set the value in Server code, and on Client Side try to Access it, I get it's previous (initial value) , not it's new current value??
 I have RadAjax Manager and grid on page and all ajaxified ControlId's and UpdatedControls in it. And that Server set Viewstate Var is not nor seems to be able to be.
Script and Grid are wrapped in RadCodeBlocks.

If I try it a few times, it always returns the Previous not current value.
The current Value is set in C#  after a straightforward    __DoPOstback(Arg_Source, EventArgs). The rest of the Controls on the page are set for Ajax postbacks as per the RadAjaxManager.

How do I retrieve the current value of this ViewState Var when in JS??

Thx
Neal

 

1 Answer, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 19 Aug 2010, 09:33 AM
Hello Neal,

Can you post some sample code? Public server variables should be accessible from inline code expressions in the markup (<%= %>) OK. Inline code expressions (<% %> and <%= %>) are evaluated at render time, so you should have your ViewState value updated by the time you access it.

Veli
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Ajax
Asked by
Neal
Top achievements
Rank 1
Answers by
Veli
Telerik team
Share this question
or