0

i have a drop down list. I am selecting multiple options and saving it but in edit mode, i want the selected item to be selected back in list of item in drop down list in Mvc using razor

// here i am uploading document by selecting users

   <fieldset>
        <legend>DocShared</legend>



        <div class="editor-label">
            <label for="file">Please select File To Upload</label>
        </div>
        <div class="editor-field">
            <input type="file" name="ChooseFile" />
        </div>
        <div class="editor-label">
            <label>Please select Single/Muliple Users</label>
        </div>
        <div class="editor-field">
            <input type="text" name="Description" />
        </div>
        <div class="editor-label">
            <label>Description</label>
        </div>
        <div class="editor-field">

            @Html.DropDownListFor(m => m.Users, Model.AllEmployess, new { @id = "multiple", @class = "chosen", @multiple = "multiple", style = "width: 350px;"  })
        </div>

        <p>
            <input type="submit" value="Save&Upload" />
        </p>
    </fieldset>

// now in the edit i am getting a list but i want the dropdownlist selected item (In the same view)

  • Explain in more detail!! – Saber Amani Apr 30 '14 at 17:18
  • Given you're mentioning DropDownListFor, am I right to assume that this is in an MVC View? – dyson Apr 30 '14 at 17:18
  • Saving it but in edit mode? I want the selected item to be selected in list of item -- do you mean on next load of page do you want to mark previous set of selection as selected? – Amnesh Goel Apr 30 '14 at 17:19
  • Yes on the next load of the view i want the selected values to be highlighted . i am getting the saved values in the form of list – user3537886 Apr 30 '14 at 17:39
  • Check this link to get a clue http://stackoverflow.com/questions/774587/multi-select-dropdown-list-in-asp-net. And for MVC, perhaps some MVC guy can help. – Amnesh Goel Apr 30 '14 at 17:43
  • but in the above link its said just the how to save it and get into other list. But we need the edit of dropdown list where the item should be selected – user3537886 Apr 30 '14 at 17:48

0 Answers0