gpt4 book ai didi

c# - 如何将多个复选框项目列表发送到类(class)

转载 作者:太空宇宙 更新时间:2023-11-03 16:28:27 26 4
gpt4 key购买 nike

我想将所有选定的复选框项目发送到类(class)我该如何发送它。如果我使用 check1.selectedvalue/item 它只发送一个。那么我该怎么做

protected void check1_SelectedIndexChanged(object sender, EventArgs e)
{
for (int z = 0; z < check1.Items.Count; z++)
{
if (check1.Items[z].Selected)
{
string checking = "\u2022" + check1.Items[z].Text ;
}
}

Mail emailsystem = new Mail();
emailsystem.GetEmail(comment.Text, StatusList.SelectedValue, check1.SelectedValue);
}

最佳答案

您需要连接选中复选框的文本并将其传递给您的电子邮件系统

protected void check1_SelectedIndexChanged(object sender, EventArgs e)
{
string checking = "";
for (int z = 0; z < check1.Items.Count; z++)
{
if (check1.Items[z].Selected)
{
checking += "\u2022" + check1.Items[z].Text;
}
}

Mail emailsystem = new Mail();
emailsystem.GetEmail(comment.Text, StatusList.SelectedValue, checking );
}

关于c# - 如何将多个复选框项目列表发送到类(class),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11658463/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com