1

In line 5 below I'm attempting to concatenate a variable inside of two strings such that the resulting HTML string inside of my javascript looks like this <iframe src="ImageUpload.aspx?ID=Foo" width="100%" height="100%" frameborder="0"></iframe>

Here's my javascript as I've written it. What is the correct syntax for line #5? Everything else is correct.

if (buttontext == "Add Photo Log") {
    var mastertable = $find("<%=RadGrid1.ClientID %>").get_masterTableView();
    var PackageID = mastertable.get_dataItems()[0].getDataKeyValue("PackageID");

    $.fancybox(
        '<iframe src="ImageUpload.aspx?ID=' +PackageID '" width="100%" height="100%" frameborder="0"></iframe>',
        {
            'autoDimensions': false,
            'width': 700,
            'height': 'auto',
            'transitionIn': 'none',
            'transitionOut': 'none'
    });
}

4 Answers 4

5

You've almost got it. Add another + after PackageID

'<iframe src="ImageUpload.aspx?ID=' + PackageID + '" width="100%" height="100%" frameborder="0"></iframe>'
Sign up to request clarification or add additional context in comments.

1 Comment

Bingo! That was it. Thank you. I'll accept your answer in 11 minutes. SO makes you wait for some reason.
2

There is a + missing:

'<iframe src="ImageUpload.aspx?ID=' +PackageID+ '" width="100%" height="100%" frameborder="0"></iframe>',

Comments

1

You missed a "+"

'<iframe src="ImageUpload.aspx?ID=' +PackageID+ '" width="100%" height="100%" frameborder="0"></iframe>',

Comments

1
'<iframe src="ImageUpload.aspx?ID=' + PackageID + '" width="100%" height="100%" frameborder="0"></iframe>'

You were missing a +

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.