Showing posts with label static. Show all posts
Showing posts with label static. Show all posts

Monday, March 26, 2012

Access page viewstate from static method?

Does anyone know how to grab the current Session, or Viewstate from within a public static method? I've got some WebMethods and I'd like to get the page context once inside of the server-side method.

Thanks,
Mark

You can access the Session, but not the ViewState.

Inside a static method, you need to reference the Session like so: HttpContext.Current.Session


You can also pass EnableSession=true to the WebMethod attribute, but honestly I'd strongly recommend just sending the values up the pipe if at all possible (as params).

Saturday, March 24, 2012

about AtlasUIDragDrop.js

hi,

i have seen some article described the method how to create the drag and drop window,but all are static.such as:

<control id="content1">
<behaviors>
<draggableListItem handle="content1Title" dataType="HTML" />
</behaviors>
</control>

i has checked that Sys.UI.DraggableListItem is a class in the AtalasUIDragDrop.js,but why i can not use in this way:

var obj=new Sys.UI.DraggableListItem();

the browser alert that it is an error!!!

but why i can use this:

var obj=new Sys.Timer();?

if i can use Sys.UI.DraggableListItem,i think i will implement the dynamic crreating drag and drop function.

who can help me?

Hi,

please verify that

1) you added a reference to the AtlasUIDragDrop.js file.
2) you put the dynamic code after the framework (i.e. the Sys.Application object) has raised the load event.