本文介绍了多个复选框帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在asp.net MVC 3中创建一个应用程序
我的视图上应该有多个复选框

我有一个模型类,并基于此模型生成视图,该问题是由多个复选框引起的

这是我的模型课

Hi,
I am creating an application in asp.net MVC 3
I should have multiple check boxes on my View

I have a model class and based on it i am generating my View the problem is arising with multiple Check box

here is my Model class

public class FormModel
   {
       public string ID { get; set; }
       public int No { get; set; }
       public string type { get; set; }
       public string value { get; set; }

       public string[] Ctype //Multiple Check Boxes
       {
           get;
           set;
       }

   }

and on View i am using this


<table>
    <tr>
    <td>Enter ID:</td>
    <td> @Html.TextBoxFor(m => m.ID)</td>
    </tr>
    <tr>
    <td>Enter Number of controls wanted:</td>
    <td>@Html.TextBoxFor(m => m.No)</td>
    </tr>
    <tr>
    <td>Select type of control:</td>
    <td> @Html.DropDownListFor(m => m.type,items)</td>
    <td>@Html.CheckBoxFor(m=> m.Ctype)</td>
    </tr>
    <tr>
    <td>Value:</td>
    <td>@Html.TextBoxFor(m => m.value)</td>

m is the reference of model class
</tr></table>



问题出现在CheckBoxFor,它说不能将string []隐式转换为bool


谁能帮我解决这个



The problem is arising at CheckBoxFor, it is saying that cannot implicitly convert string[] to bool


Can any one help me out on this

推荐答案


这篇关于多个复选框帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-20 22:14