0

Hi I have problem with JavaScript function with parameters.

I created function:

function setBundleExpiration(parameters) {
    alert(parameters);
};

and in C# code behind I add some parameters:

Link.OnClientClick = "setBundleExpiration(" + Test.AuthorizedUserID + ");";

this is guid parameter and this does not work. I have problem in JS like:

 SCRIPT1006: Expected ')'

but if I use id as parameter id with 3 char length then is okay.

and here is place in html where error message shows:

 <a onclick="setBundleExpiration(3110cb24da214b4cbc00eb5cd5e020fc);"

link is correctly closed!

Can somebody show me how to pass few parameter to js or query function without errors ? Please

1 Answer 1

3
Link.OnClientClick = "setBundleExpiration('" + Test.AuthorizedUserID + "');";

Try adding ' around your GUID. The JS thinks your GUID is a variable. You need to pass it as a string.

Sign up to request clarification or add additional context in comments.

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.