如何在ajax html编辑器中添加html复选框

时间:2016-08-09 09:49:47

标签: html asp.net ajax

我试图在ASP.NET中的Ajax HTML编辑器中添加一个HTML复选框,但我无法检查和取消选中它。这是我试过的代码。请提出一些建议。

webform.aspx

 <%@ Register Assembly="AjaxControlToolkit"     
    Namespace="AjaxControlToolkit.HTMLEditor"
    TagPrefix="cc3" %>
<cc3:Editor ID="uwNotes" runat="server" Width="800px" Height="800px">           
</cc3:Editor>

webform.aspx.cs

decodedtext="";

 decodedtext = decodedtext.Append("<p><b>PLEP: </b><input type=\"CheckBox\"                     
 id=\"checkbox1\" enabled=\"true\">YES</p>");

 uwNotes.Content = decodedtext;

5 个答案:

答案 0 :(得分:0)

您可以使用流动语法

添加复选框
<input type=\"checkbox\" value=\"Y\"  style=\"height:auto\" ">

答案 1 :(得分:0)

var editor;  // use a global for the submit and return data rendering in the examples

$(document).ready(function() {
editor = new $.fn.dataTable.Editor( {
    "ajax": "../File Path",
    "table": "#example",
    "fields": [ {
            label:     "Active:",
            name:      "active",
            type:      "checkbox",
         options:   [ { label: '', value: 1 }]
             ]} );

答案 2 :(得分:0)

function(render){
  render :<input type=\"checkbox\" value=\"Y\">
 }

答案 3 :(得分:0)

&#13;
&#13;
        var response = { optionA: 'One', optionB: 'Two', optionC: 'Three' };

               // this would go in your ajax success handler
                   $.each(response, function (key, value) {var li = $('<li><input type="checkbox" name="' + key + '" id="' +         key + '"/>' +
                 '<label for="' + key + '"></label></li>');
                 li.find('label').text(value);
                    $('#wkslist').append(li);
                       });
&#13;
#wkslist {
    list-style-type: none;
    padding: 0;
}
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<ul id="wkslist"></ul>
&#13;
&#13;
&#13;

               #wkslist {
       list-style-type: none;
             padding: 0;
                  }

             <script   src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js">
           </script>
           <ul id="wkslist"></ul>

答案 4 :(得分:0)

这是您的问题的一个示例:

var response = { optionA: 'One', optionB: 'Two', optionC: 'Three' };
$('#json').val('response[i]');
$("button").click(function(){  
$('<p><input type="checkbox"/><span>Response Text</span></p>').insertAfter("li");  
    });  
#wkslist {
    list-style-type: none;
    padding: 0;
}
.respons{
  width:200px;
  height:100px;
  overflow-y:auto;
  border:1px solid #600;
  color:green;
}
button{margin-top:10px;}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="respons">
<ul id="wkslist">
<li></li>
</ul>
</div>
<button id="res">Response</button>