之前发过用POST方式的http://www.cnblogs.com/blodfox777/articles/1271912.html
而用__postback比较高阶,代码出自NC01
private
void
Page_Load(
object
sender, System.EventArgs e)
{
// Insure that the __doPostBack() JavaScript method is created
this .GetPostBackEventReference( this , string .Empty);
if ( this .IsPostBack )
{
string eventTarget = ( this .Request[ " __EVENTTARGET " ] == null ) ? string .Empty : this .Request[ " __EVENTTARGET " ];
string eventArgument = ( this .Request[ " __EVENTARGUMENT " ] == null ) ? string .Empty : this .Request[ " __EVENTARGUMENT " ];
if ( eventTarget == " initializeServerSidePostBack " )
{
string valueSent = eventArgument;
}
}
else
{
ClientScript.RegisterStartupScript(GetType(Page), " initializeServerSideScript " , " initializeServerSide(); " , true )
}
}
{
// Insure that the __doPostBack() JavaScript method is created

this .GetPostBackEventReference( this , string .Empty);
if ( this .IsPostBack )
{
string eventTarget = ( this .Request[ " __EVENTTARGET " ] == null ) ? string .Empty : this .Request[ " __EVENTTARGET " ];
string eventArgument = ( this .Request[ " __EVENTARGUMENT " ] == null ) ? string .Empty : this .Request[ " __EVENTARGUMENT " ];
if ( eventTarget == " initializeServerSidePostBack " )
{
string valueSent = eventArgument;
}
}
else
{
ClientScript.RegisterStartupScript(GetType(Page), " initializeServerSideScript " , " initializeServerSide(); " , true )
}
}


<script type="text/javascript">
<!--
function initializeServerSide()
{
// Get the value to return here

var eventArgument = 'Some value to send server-side';
__doPostBack('initializeServerSidePostBack', eventArgument)
}
// -->
</script>