Opening and closing braces issue

45 views Asked by At

I can't figure out this error while my all parenthesis are correctly closed.

The error

1

There are 1 answers

0
Gabriel Luci On

There are a few things wrong here:

  1. You are already in a code block, so you don't need to use @:.

  2. You need to double-up on the { } since you are initializing an object (ViewDataDictionary) that is a collection of more objects (KeyValuePair<string, object>).

  3. RenderPartial does not return a string. Use @Html.Partial instead.

<select id="multiselect" name="Checkbox"
     onChange="@Html.Partial("GalleryListing", new ViewDataDictionary(this.ViewData) { { "param1", this.Value } })">