核对清单问题请帮助 [英] checkboxlist question pls help

查看:73
本文介绍了核对清单问题请帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我在asp.net应用程序中有一个复选框列表.现在,我需要知道是否有一个选定的项目,这将成为我处理IF/ELSE条件的基础.

我需要在这里进行服务器端验证,而不需要客户端验证.

请帮助我!

Hi all,

I have a checkbox list in asp.net application. Now i need to know if there is an item that is selected which will be my basis for my IF/ELSE condition.

I need server-side validation here and not client-side.

Please help me!

推荐答案



创建一个将返回布尔值并将其命名为IsValid的方法.在其中添加以下代码.

Hi,

Create a method that will return a Boolean value and name it as IsValid. The add the following codes in it.

retval = false
foreach(ListItem chk in CheckBoxList1.Items)
{
   if(chk.Checked == false)
   {
      continue;
   }
   if(chk.Checked == true)
   {
      return true;
   }
}
return retval;



问候,
爱德华



Regards,
Eduard


这篇关于核对清单问题请帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆