1

I'm using Entity Framework and from my 6 radio buttons I want to write the value in code_options.

How can it be done ? 6 radiobuttons returns

After writing I need to read this data.(part 2).

EDIT : I was thinking to concatenate 6 strings provided by my 6 radiobuttons and send this to my database. Not sure if it will work.

@{
        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>
4

1 回答 1

0

我不知道 ASP.NET MVC 提供开箱即用的任何方式来执行此操作。然而,你可以很容易地用 javascript 做到这一点。假设 code_options 是你的模型的一部分,为它做一个隐藏的输入:

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

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

于 2012-04-24T18:51:01.573 回答