Double quotes in VB.NET

Posted on 2006-05-02
Last Modified: 2008-01-09
Hi i'm writing a control and i am having trobles with a little javascript in my html.

This is what i would like to achieve

<input type="radio" value="strValue" onclick="show_data(this.value,'Hi, this is some text')" name="rbnEmailTemplate">

Is there a break so i can use double quotes in my code:

So i can write something like this:

Output.Write(String.Format("<input type="radio" value="{0}" onclick="show_data(this.value,'{1}')" name="rbnEmailTemplate">", objEmailTemp.EmailTemplateID, "HI, this is some text"))


Question by:apb2
    LVL 6

    Author Comment

    This works

    Output.Write(String.Format("<input type=" & Chr(34) & "radio" & Chr(34) & " value=" & Chr(34) & "{0}" & Chr(34) & " onclick=" & Chr(34) & "show_data(this.value,'{1}')" & Chr(34) & " name=" & Chr(34) & "rbnEmailTemplate" & Chr(34) & ">", objEmailTemp.EmailTemplateID, "HI"))

    But is there a easier way, that just uses a character break

    LVL 44

    Accepted Solution

    Hi apb2,

    Double them:

    Output.Write(String.Format("<input type=""radio""  value=""{0}"" onclick=""show_data(this.value,'{1}')"" name=""rbnEmailTemplate"">", objEmailTemp.EmailTemplateID, "HI"))

    This will put a single " in the resulting string.

    Tim Cottee
    LVL 9

    Expert Comment

    There isn't a way to declare a literal string like in C#.  You need to use the double quotes as in:

    Output.Write(String.Format("<input type=""radio"" value=""{0}"" onclick=""show_data(this.value,'{1}')"" name=""rbnEmailTemplate"">", objEmailTemp.EmailTemplateID, "HI, this is some text"))
    LVL 6

    Author Comment


    Nice one

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
    Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now