我需要迭代List<String>,每个元素都有s:checkbox.
我在Action层中定义了一个列表来保留选定的元素.
使用我的代码,我可以提交表单并在动作层中捕获选定的值.但是,必须预先检查一些复选框.加载页面时,我无法显示预先检查的状态.
Value1 包含String对象列表.
functionCheckBoxList - 我已定义的列表以保持已检查的元素
在加载时,我添加了functionCheckBoxList属于的一些元素Value1.
但仍然没有在页面中显示预先检查的状态.
<s:iterator value="value1" var ="functionName">
<s:checkbox fieldValue="%{#functionName}" name="functionCheckBoxList"
value="%{#functionName}" theme="simple" >
</s:checkbox>
</s:iterator>
Run Code Online (Sandbox Code Playgroud)
注意:我知道如何使用s:checkboxlist但不能在这里,因为我需要在迭代中使用特殊格式.
我认为这很容易编码,但事实是我最终面临着获取TNewCheckListBox.
我尝试将复选框和单选按钮设置为全局实例,以便我可以在NextButtonClick事件中轻松访问它。
但在这个示例测试中我得到
无法调用过程。
[Code]
var
PageChoixComposants: TWizardPage;
CB1, CB2: TNewCheckBox;
OB1, OB2: TNewRadioButton;
procedure InitializeWizard;
var
CheckListBox: TNewCheckListBox;
begin
PageChoixComposants := CreateCustomPage(
wpWelcome, 'Custom wizard page controls', 'TNewCheckListBox');
CheckListBox := TNewCheckListBox.Create(PageChoixComposants);
CheckListBox.Width := PageChoixComposants.SurfaceWidth;
CheckListBox.Height := ScaleY(97);
CheckListBox.Flat := True;
CheckListBox.Parent := PageChoixComposants.Surface;
CB1 := CheckListBox.AddCheckBox('CB1', '', 0, True, True, False, True, nil);
OB1 := CheckListBox.AddRadioButton('CB1 OB1', '', 1, True, True, nil);
OB2 := CheckListBox.AddRadioButton('CB1 OB2', '', 1, False, True, nil);
CB2 := CheckListBox.AddCheckBox('CB2', '', …Run Code Online (Sandbox Code Playgroud) 谁能告诉我如何在 checkboxlisttile 中选择多个选项。在这里我只能单击一个选项。当我检查特定项目时,我想将数据库中注释表中的状态列设置为已完成。(实际上,我想选择已完成的项目并将其显示在另一个名为“已完成”的选项卡下。checkboxlisttile 是动态创建的,即从数据库中创建。添加新注释时,它会显示在此列表视图中。)
note_info.dart //这是显示笔记的屏幕,即列表视图
import 'dart:io';
import 'package:vers2cts/models/note_model.dart';
import 'package:vers2cts/models/customer_model.dart';
import 'package:vers2cts/services/db_service.dart';
import 'package:vers2cts/utils/db_helper.dart';
import 'package:flutter/material.dart';
import 'package:sqflite/sqflite.dart';
import 'new_note.dart';
class Note_Info extends StatefulWidget{
final String appBarTitle;
final CustomerModel customer;
//Note_Info();
Note_Info(this. customer, this.appBarTitle);
@override
State<StatefulWidget> createState() {
//return Note_InfoState();
return Note_InfoState(this. customer,this.appBarTitle);
}
}
class Note_InfoState extends State<Note_Info> {
DBService dbService = DBService();
List<NoteModel> noteList;
int count = 0;
static final GlobalKey<ScaffoldState> scaffoldKey = new GlobalKey<ScaffoldState>();
NoteModel note=NoteModel();
String appBarTitle;
CustomerModel customer=new CustomerModel();
Note_InfoState(this.customer, this.appBarTitle);
bool rememberMe …Run Code Online (Sandbox Code Playgroud) 我有一堆由asp.net CheckBoxList控件生成的复选框.我想获取用户在页面上控件旁边看到的文本.
使用类似的控件,如RadioButtonList,我已经能够通过这样做在jQuery中获取它们的值:
var selected = $("input:checked[id*='" + Control.id + "']");
Run Code Online (Sandbox Code Playgroud)
然后循环并获取值:
var whatIwant = selections[i].value;
Run Code Online (Sandbox Code Playgroud)
(在这种情况下,"值"将是我想要的文本).
但是 - CheckBoxList渲染方式不同.对于每个ListItem,不仅有输入,还有像这样的html标签:
<input id="ctl00_ContentPlaceHolder1_ConsultedList_0" type="checkbox" name="ctl00$ContentPlaceHolder1$ConsultedList$0" />
<label for="ctl00_ContentPlaceHolder1_ConsultedList_0">Other service providers</label>
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,输入标记本身,这是我的小jQuery查询找到的,不包括我想要的信息:"其他服务提供商".那是在标签上.
任何人都可以想到一个很好的解决方案 - 也许是一个让CheckBoxList在输入标签中呈现我需要的文本的好方法,或者一些聪明的jQuery来找到与所选输入相对应的标签?
我在Java SWT中找不到CheckedListBox.请指出一种扩展List到支持复选框的方法.
借助于string.join,我们可以拆分以逗号分隔的值列表.
string.join(",", array)
Run Code Online (Sandbox Code Playgroud)
我可以为CheckboxList数据源执行相同的操作吗?我有一个DataValueField为此,需要一个逗号分隔值而不进行迭代.
我有一个复选框组,我使用@DbLookup获取要显示的项目复选框.它工作正常,除了几个我从查找中获得超过230个值的情况.在这种情况下,我得到一个值为"Infinity"的复选框.我想这告诉我我的复选框组中有太多选择.
您可以在复选框组中放置的值数量是否有限制?处理存在大量值的情况的最佳方法是什么?我可能只是采取"如果返回的值超过100,截断列表"的路线.
我的 ascx 文件中有此复选框:
<asp:CheckBoxList ID="chk" runat="server" RepeatLayout="Table" RepeatDirection="Horizontal" RepeatColumns="1">
Run Code Online (Sandbox Code Playgroud)
我想要一个选项来选择列表中的任何选项。但我的复选框列表默认选择第一个选项。当我取消选中它并保存和加载页面时,第一个选项被选择。
我使用此代码取消选择但不起作用:
if (string.IsNullOrEmpty(chk.SelectedValue))
{
foreach (ListItem item in chk.Items)
{
item.Selected = false;
}
chk.SelectedIndex = -1;
}
Run Code Online (Sandbox Code Playgroud)
我在页面的 Page_Load 和 Page_PreRender 中使用此代码。并且 chk.SelectedValue 为 null 或为空。但第一项已检查
我使用此代码将数据绑定到复选框列表:
var it = new ListItem {Text = arr1[0], Value = arr1[1];
chk.Items.Add(it);
Run Code Online (Sandbox Code Playgroud) 我已经看到了有关该主题的其他线程,但在我认为正确的语法/设置方面遇到了麻烦。最终,当角色列表从编辑返回时,控制器无法看到角色列表的内容。
看法
@model Models.Volunteer
@foreach (var item in Model.Roles)
{
<input type="checkbox" asp-for="@item.Selected" />
<label asp-for="@item.Selected">@item.RoleName</label>
<input type="hidden" asp-for="@item.RoleId" />
<input type="hidden" asp-for="@item.RoleName" />
<br />
}
<input type="submit" value="Save" class="btn btn-default" />
Run Code Online (Sandbox Code Playgroud)
模型
public abstract class BaseVolunteer
{
[Key]
public int Recno { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Email { get; set; }
public string City { get; set; }
[NotMapped]
[Display(Name = "Roles")]
public …Run Code Online (Sandbox Code Playgroud) 我正在使用CheckBoxListTile这样的,
CheckboxListTile(
title: Text(
ourAllnotes[i].note,
style: TextStyle(color: Colors.white),
),
value: false,
onChanged: (bool value) {},
activeColor: Colors.orange,
checkColor: Colors.white,
controlAffinity: ListTileControlAffinity.leading,
)
Run Code Online (Sandbox Code Playgroud)
我可以在选中复选框后更改其颜色,但在选中之前无法更改其颜色而不是默认值。怎么做?
checkboxlist ×10
checkbox ×3
asp.net ×2
c# ×2
flutter ×2
asp.net-core ×1
inno-setup ×1
java ×1
jquery ×1
pascalscript ×1
radio-button ×1
string ×1
struts2 ×1
swt ×1
xpages ×1