Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/entity-framework/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc ASP.NET Razor RadioButton选择多个单选按钮,返回一个字段中的数据_Asp.net Mvc_Entity Framework_Razor - Fatal编程技术网

Asp.net mvc ASP.NET Razor RadioButton选择多个单选按钮,返回一个字段中的数据

Asp.net mvc ASP.NET Razor RadioButton选择多个单选按钮,返回一个字段中的数据,asp.net-mvc,entity-framework,razor,Asp.net Mvc,Entity Framework,Razor,我正在使用实体框架,从我的6个单选按钮中,我想在代码选项中写入值 怎样才能做到呢? 写完后,我需要阅读这些数据。(第二部分) 编辑:我正在考虑连接6个单选按钮提供的6个字符串,并将其发送到我的数据库。不确定它是否会起作用 @{ string po = " "; string sb = " "; string cb = " "; string rl = " "; string pi = " "; string ca = " "; }

我正在使用实体框架,从我的6个单选按钮中,我想在代码选项中写入值

怎样才能做到呢?

写完后,我需要阅读这些数据。(第二部分)

编辑:我正在考虑连接6个单选按钮提供的6个字符串,并将其发送到我的数据库。不确定它是否会起作用

@{
        string po = " "; string sb = " "; string cb = " "; string rl = " "; string pi = " "; string ca = " ";
     }                     

    <div class="editor-label">
        @Html.LabelFor(model => model.panou_ornament)
    </div>
    <div class="editor-field">
        Panel ornamental
        @Html.RadioButton(po, "1") DA
        @Html.RadioButton(po, "0") NU            
    </div>
    <div class="editor-field">          
        Sticle bombate
        @Html.RadioButton(sb, 1) DA
        @Html.RadioButton(sb, 0) NU
    </div>
    <div class="editor-field">
        Curburi
        @Html.RadioButton(cb, 1) DA
        @Html.RadioButton(cb, 0) NU            
    </div>
    <div class="editor-field">
        Rolete
        @Html.RadioButton(rl, 1) DA
        @Html.RadioButton(rl, 0) NU
    </div>
    <div class="editor-field">
        Profile infoliate
        @Html.RadioButton(pi, 1) DA
        @Html.RadioButton(pi, 0) NU
    </div>
    <div class="editor-field">
        Contractul are si pozitii din aluminiu
        @Html.RadioButton(ca, "1") DA
        @Html.RadioButton(ca, "0") NU
        @Html.Hidden(Model.panou_ornament = po + sb + cb + rl + pi + ca)    
    </div>
@{
字符串po=“”;字符串sb=“”;字符串cb=“”;字符串rl=“”;字符串pi=“”;字符串ca=“”;
}                     
@LabelFor(model=>model.panou_装饰)
装饰板
@单选按钮(po,“1”)DA
@单选按钮(po,“0”)NU
硬炸药
@单选按钮(sb,1)DA
@单选按钮(sb,0)NU
科布里
@单选按钮(cb,1)DA
@单选按钮(cb,0)NU
罗莱特
@Html.RadioButton(rl,1)DA
@单选按钮(rl,0)NU
配置文件信息链接
@单选按钮(pi,1)DA
@单选按钮(pi,0)NU
合同为硅锌铝合金
@单选按钮(ca,“1”)DA
@单选按钮(ca,“0”)NU
@隐藏(Model.panou_装饰=po+sb+cb+rl+pi+ca)

我不知道ASP.NET MVC有什么现成的方法可以做到这一点。然而,使用javascript可以相当容易地做到这一点。假设code_选项是模型的一部分,则为其创建一个隐藏输入:

@Html.HiddenFor(m => m.code_options)

然后使用jQuery连接click处理程序并执行必要的二进制操作,将结果存储在您创建的隐藏输入中。你可以找到关于位运算符的文档。

我不太擅长javascript。你能给我举个小例子吗?