vendredi 27 septembre 2019

How to get values in Check boxes from database using viewbag?

I am using view bag to get skills. How to get data from viewbag in @html.Checkboxfor().

  ViewBag.ListSkill = GetSkills();


  public List<UserViewModel> GetSkills()
    {
        var client = new RestClient(url);
        var request = new RestRequest("api/Users/GetAllSkillList", Method.GET);
        var response = client.Execute<List<UserViewModel>>(request);


        return response.Data;
    }

I saw many examples using viewbag but they all using but I need to write the code in @html.Checkbox. Please Help.




Aucun commentaire:

Enregistrer un commentaire