I am creating one asp page. In that page i defined one property like below
.cs
private long _sequence;
public long Sequence { get { return _sequence; } set { _sequence = value; } }
Now i want to retrieve this property value in js file. Actually i can retrieve it in .aspx but i want it in .js file.
here is my js function and .aspx code which i am trying but it could not find property value
.aspx
<asp:Button ID="btnShowSimple" runat="server" Text="Notes Dialog" OnClientClick="NotesDialog(this)" />
.js
function NotesDialog(ctr) {
var ControlName = document.getElementById(ctr.id);
$("#btnShowSimple").click(function (e) {
ShowDialog(false);
e.preventDefault();
LoadData("GetNotes", '"sequence":<%= this.Sequence %>');
});
}
Anything I am missing?? If anyone have any idea about it than please help me..I am facing this problem since two days..
Your
jsfiles are static files on the server. You cannot use those<%= %>tags in them.You could pass the property via a global javascript variable, that you set in your
aspxpage and use in yourjsfile.i.e.
.aspx
.js