I have this LinkButton:
<asp:LinkButton runat="server" CssClass="lFilename"
ID="grdlinkFilename" Text='<%#Eval("FILEPATH")%>'
CommandArgument='<%#Eval("FILEPATH")%>' OnCommand="grdlinkFilename_click"
data-id='<%#Eval("FILEPATH")%>'> </asp:LinkButton>
And in my external jquery file I did this:
var result = $("#grdlinkFilename").attr("data-id");
result = result.replace(/D:\\/i, "http://ip/Vdrive/");
result = result.replace(/\\/g, "/");
What I want to do is to pass the value from the <%#Eval("FILEPATH")%>
to my external jquery file. Suppose the value of <%#Eval("FILEPATH")%
> is d:\folder\img.jpg
in jquery.
I want to change from d:\folder\img.jpg
to d:\\folder\\img.jpg
(which is missing from my code for the jquery file).
Next again using jquery i'm going to change from d:\\folder\\img.jpg
to http://ip/Vdrive/folder/img.jpg
.
My concerns are:
- Is my way off passing the value from my asp:linkbutton to external
js file is correct including the way I call it? as in
var result = $("#grdlinkFilename").attr("data-id");
- If the way I pass the value from asp:linkbutton to external js file is correct, how can I convert it's value to let say from "d:\folder\img.jpg" to "
d:\\folder\\img.jpg
"?