Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/34.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
C# 使用单选按钮显示/隐藏tinymce_C#_Asp.net_Asp.net Mvc_Tinymce - Fatal编程技术网

C# 使用单选按钮显示/隐藏tinymce

C# 使用单选按钮显示/隐藏tinymce,c#,asp.net,asp.net-mvc,tinymce,C#,Asp.net,Asp.net Mvc,Tinymce,我试着用拉多布顿来显示/隐藏一点。比如是/否。所以有两个单选按钮。是-将显示微型mce,否将隐藏微型mce 我有这个: 显示微型mce: <div class="form-group"> @Html.Label(Resources.Entity.Product.PdfMessage, new { @class = "text-bold control-label col-md-2" }) <div class="col-lg-6 col-md-8 col-sm-

我试着用拉多布顿来显示/隐藏一点。比如是/否。所以有两个单选按钮。是-将显示微型mce,否将隐藏微型mce

我有这个:

显示微型mce:

<div class="form-group">
    @Html.Label(Resources.Entity.Product.PdfMessage, new { @class = "text-bold control-label col-md-2" })
    <div class="col-lg-6 col-md-8 col-sm-10 ">
        @Html.EditorFor(model => mailModel.PdfMessage, new { htmlAttributes = new { @class = "form-control tiny-mce", data_lang = System.Globalization.CultureInfo.CurrentUICulture.Name, id = "tinyMCE" } })
        @Html.ValidationMessageFor(model => mailModel.PdfMessage)
        @*@Html.TextArea("MailProductHandlers_message", mailModel.Message, new { @class = "form-control", @rows = 15 })*@
    </div>
</div>

您的id属性缺少@符号: 按如下方式修改脚本:

***编辑单选按钮的某些内容似乎不正确只有一个按钮应该被选中并且它们应该具有相同的名称**

您可以在Jquery中使用#来表示和标识,而不是通过属性来查找它

编辑我更改了一些内容,我认为您不需要两个单独的ID。我将它们分组到一个类中,您应该能够从该类中检查更改事件,而不是同时检查两个ID

@Html.EditorFor(model => mailModel.PdfMessage, new { htmlAttributes = new { @class = "form-control tiny-mce", @id = "tinyMCE", @data_lang = System.Globalization.CultureInfo.CurrentUICulture.Name  } })


@Html.RadioButtonFor(model => model.IsChecked, "Yes", new { @checked = true, @class = "pdfchecker" })

// only one should be checked
@Html.RadioButtonFor(model => model.IsChecked, "No", new { @checked = false, @class = "pdfchecker" })



<script>
    // this is short hand for document ready
    $(function () {
        //# is to denote an ID, . is to denote a class in jQuery the change function is hit when a radio button is change check the name to make sure they are apart of the same grouping
        $(".pdfchecker").change(function () {
            if ($(this).is(':checked')) {
                $('#tiny-mce').show();
            }
            else {
                $('#tiny-mce').hide();
            }
   });






</script>
@Html.EditorFor(model=>mailModel.PdfMessage,new{htmlAttributes=new{@class=“form control tiny mce”、@id=“tinyMCE”、@data\u lang=System.Globalization.CultureInfo.CurrentUICulture.Name})
@RadioButton(model=>model.IsChecked,“Yes”,new{@checked=true,@class=“pdfchecker”})
//只应检查一个
@RadioButton(model=>model.IsChecked,“No”,新的{@checked=false,@class=“pdfchecker”})
//这是文档就绪的简写
$(函数(){
//#是表示一个ID,。是表示jQuery中的一个类。当一个单选按钮被选中时,change函数被点击。检查名称以确保它们是同一个分组中的一部分
$(“.pdfchecker”).change(函数(){
如果($(this).is(':checked')){
$(#tiny mce').show();
}
否则{
$(#tiny mce').hide();
}
});

你的问题是什么?这不起作用。它不显示/hide我认为你想要@idOke,谢谢。在我的模型中,我被检查为int。我会试试。我会让你知道它是否起作用-
<script>
    $(document).ready(function () {
        $("input[Id='radioButton']").click(function () {
            if ($(this).is(':checked')) {
                $('#tiny-mce').show();
            }
            else {
                $('#tiny-mce').hide();
            }
        });
    });
</script>
@Html.EditorFor(model => mailModel.PdfMessage, new { htmlAttributes = new { @class = "form-control tiny-mce", @id = "mceu_61", data_lang = System.Globalization.CultureInfo.CurrentUICulture.Name } })
@Html.EditorFor(model => mailModel.PdfMessage, new { htmlAttributes = new { @class = "form-control tiny-mce", @id = "tinyMCE", @data_lang = System.Globalization.CultureInfo.CurrentUICulture.Name  } })


@Html.RadioButtonFor(model => model.IsChecked, "Yes", new { @checked = true, @class = "pdfchecker" })

// only one should be checked
@Html.RadioButtonFor(model => model.IsChecked, "No", new { @checked = false, @class = "pdfchecker" })



<script>
    // this is short hand for document ready
    $(function () {
        //# is to denote an ID, . is to denote a class in jQuery the change function is hit when a radio button is change check the name to make sure they are apart of the same grouping
        $(".pdfchecker").change(function () {
            if ($(this).is(':checked')) {
                $('#tiny-mce').show();
            }
            else {
                $('#tiny-mce').hide();
            }
   });






</script>