I have one url in which i have to send the some property values. My property like below
public string MyValue
{
get { return MyValue; }
set { MyValue = value; }
}
Now I want to send this value as parameter to the url in window.open method in javascript.
window.open("../SearchPage/MySearch.aspx?MyValue=","left=20,top=20,width=500,height=500")
I tried to access in javascript like
'<%= MyValue %>".
But this is not coming. It is giving parser error. How to achieve this?
If your JavaScript is located in a separate file, you can’t use
<%= %>to define variable there, you should usehidden fields, cookiesand similar stuffBut if you could put js in aspx page, it should work
This works for me, where MyProperty is public string property in my aspx page, please make sure that you put quotes correctly
EDIT
Here is my page be
EDIT
BTW
is not will cause StackOverflowException on set, you should create private variable for storing value 🙂