javascript - How to access filepath in aspx page -
here have declared string variable on top of page below
public string path; protected void viewfile(object sender, eventargs e) { path = (sender linkbutton).commandargument; this.page.clientscript.registerstartupscript(this.gettype(),"page_index_script","openpdf();",true); }
and want access variable in aspx page inside script tag below
<script type="text/javascript"> function openpdf() { var strmessage ='<%= path%>'; var filepath = 'http://localhost:2878/your project name/' + strmessage; window.open(filepath , 'pdf'); return true; } </script>
but variable holds file path not including '/' treat filepath string , elinimate '/' path. need not elinimate .how possible? suppose filepath "file/admin/pms" gives me on alerting strmessage ,filepath "fileadminpms"
Comments
Post a Comment