We help IT Professionals succeed at work.

Syntax error on double quote

tnova1
tnova1 asked
on
263 Views
Last Modified: 2008-04-29
Hi!


With the following javascript syntax:
                                                                   <asp:HyperLink runat="server" NavigateUrl="javascript:modipub(<%# DataBinder.Eval(Container, "DataItem.ecppubid") %>, <%# DataBinder.Eval(Container, "DataItem.sdm_sde_id") %>, <%# DataBinder.Eval(Container, "DataItem.sdm_id") %>)">
                <%#DataBinder.Eval(Container, "DataItem.ecppubno") %>
      </asp:HyperLink>

I got the error:
          Message: Parser Error: The server tag is not well formed.

So, I change it to:

      <asp:HyperLink runat="server" NavigateUrl="javascript:modipub(<%# DataBinder.Eval(Container, DataItem.ecppubid) %>, <%# DataBinder.Eval(Container, DataItem.sdm_sde_id) %>, <%# DataBinder.Eval(Container, DataItem.sdm_id) %>)">
                <%#DataBinder.Eval(Container, "DataItem.ecppubno") %>
      </asp:HyperLink>

The screen display ok, but click on the link I got the java script 'error on page'.

How do I put " around the DataBinder.Eval inside the NavigateUrl which already have a " surrounding its url.  

Many thanks,
Diane Ha
Comment
Watch Question

Top Expert 2006

Commented:
Hi tnova1,

I would do it this way (VB.NET):

<asp:HyperLink runat="server" NavigateUrl='<%# "javascript:modipub(" & DataBinder.Eval(Container, DataItem.ecppubid) & "," & DataBinder.Eval(Container, DataItem.sdm_sde_id) & "," & DataBinder.Eval(Container, DataItem.sdm_id) & ");" %>'>
                <%#DataBinder.Eval(Container, "DataItem.ecppubno") %>
     </asp:HyperLink>


-- Jason
Guy Hengel [angelIII / a3]Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009

Commented:
 <asp:HyperLink runat="server" NavigateUrl="javascript:modipub(<%# DataBinder.Eval(Container, ""DataItem.ecppubid"") %>, <%# DataBinder.Eval(Container, ""DataItem.sdm_sde_id"") %>, <%# DataBinder.Eval(Container, ""DataItem.sdm_id"") %>)">
                <%#DataBinder.Eval(Container, "DataItem.ecppubno") %>
     </asp:HyperLink>

Author

Commented:
Hi AngelIII
I already did the "" around the ""DataItem.ecppubid"".
""DataItem.sdm_sde_id"" and ""DataItem.sdm_id""

it didn't work either.

Try the """DataItem.sdm_id""". Still the same problem

Author

Commented:
Hi Jason

Try w/ your suggestion in c# (my page language is c#)

<asp:HyperLink runat="server" NavigateUrl='<%# "javascript:modipub(" + DataBinder.Eval(Container, DataItem.ecppubid) + "," + DataBinder.Eval(Container, DataItem.sdm_sde_id) + "," + DataBinder.Eval(Container, DataItem.sdm_id) + ");" %>' >                                                      <%#DataBinder.Eval(Container, "DataItem.ecppubno") %>
</asp:HyperLink>

Not working either
Top Expert 2006
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Yes, I miss the " around the DataItem.ecppubid and others again.
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.