1

How can I write

var releaseName = $('#SelectedReleaseId option:selected').text()
var templateName = $('#SelectedTemplateId option:selected').text()

this:

$("#TestplanName").text(releaseName + '-' + templateName + '-' + '@Model.UserId' + '-' + '@Model.CreatedAt');

into:

$("#TestplanName").text( '@string.Format("{0}-{1}-{2}-{3}",releaseName,templateName,@Model.UserId,@Model.CreatedAt)');

The releaseName and templateName are unknown...

1 Answer 1

1

You can't.

You're trying to mix client-side variables – which only exist in Javascript on the client – with server-side code.

Instead, you can use a Javascript equivalent of string.Format.

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

1 Comment

thanks I used the $.validator.format(xxx) as I use jquery anyway.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.