asp.net - 从复选框列表向多个号码发送短信
问题描述
从复选框列表中选择数字以发送短信
如何循环选择的每个数字
for (int i = 0; i < CheckBoxList2.Items.Count; i++)
{
if (CheckBoxList2.Items[i].Selected == true)// getting selected value from CheckBox List
{
str += CheckBoxList2.Items[i].Value + "" + "<br/>"; // add selected Item text to the String .
Label1.Text = str;
//TextBox1.Text = str.ToString();
}
}
向多个号码发送短信
解决方案
很简单,循环项目并将选中的项目添加到列表中。
List<string> list = CheckBoxList2.Items.Cast<ListItem>().Where(x => x.Selected).Select(y => y.Value).ToList();
然后您可以使用该列表发送短信。
推荐阅读
- postgresql - NestJS 在用户博客文章中插入评论
- python - 检索以scrapy开头的href
- android - 房间数据库的类型转换器不适用于具有来自另一个类的对象的类
- python - 如何检查是否有多个环境变量集用于在 PATH 中运行 Python 脚本
- swift - CoreData - 如果存在不保存,如果不存在则保存
- python - 如何在pygame中将事件限制为每帧一个事件(迭代)
- python - 使用这段代码(If...Else)如何移动?
- elasticsearch - 如何在索引期间复制 id 字段(elasticsearch)
- javascript - 防止 Three.js 透明对象在其后面剪切对象?
- bash - 无法访问 bash 脚本中的环境变量