Thursday, March 29, 2012

Passing values between client and server side (Javascript to C#)

I would like to access client side values from the code behind.

Say I open a window like this

 popWindow = window.open("data_list.aspx","dataWindow",'toolbar,width=150,height=100')
 How can I get the window name "dataWindow" from that current window or the parent window?
 Any other examples accessing variables between server side (C#) and client side (JavaScript) would be greatly appreciated.
 Regards -WH 

Page.Request.ServerVariables["SCRIPT_NAME"] will get the name of the current page. You can also pass values in a querystring, which will make them accessible to server-side code.
thanks, Page.Request.ServerVariables["SCRIPT_NAME"] worked out for me.

0 comments:

Post a Comment