是否检查了checkboxlist的问题 [英] problem with checkboxlist is checked or not
本文介绍了是否检查了checkboxlist的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想显示消息,如果没有选择任何单个项目然后显示消息检查至少一个项目.plz帮助我?
解决方案
if (BtnTitleSave.Text == 保存)
{
int count = 0 ;
for ( int i = 0 ; i < ChklistDomain.Items.Count; i ++)
{
if (ChklistDomain.Items [i] .Selected == true )
count ++;
}
if (count == 0 )
{
ScriptManager.RegisterStartupScript( this , this .GetType(), key, alert('Atleast select one domain!'), true );
}
其他
{//您的条件在这里
}
或你可以使用下面的javascript检查
function doSubmit()
{
var c = document.getElementsByTagName(' input');
for ( var i = 0 ; i < c.length; i ++)
{
if (c [i] .type.toLowerCase()== ' 复选框'&& c [ i]。已检查)
{
// 复选框已选中,优秀用户
返回( true );
}
}
// 没有复选框检查,坏用户
return ( false );
}
希望这有助于你:)
i want to show message if no any single item selected then show message check atleast one item.plz help me?
解决方案
if (BtnTitleSave.Text == "Save") { int count = 0; for (int i = 0; i < ChklistDomain.Items.Count; i++) { if (ChklistDomain.Items[i].Selected == true) count++; } if (count == 0) { ScriptManager.RegisterStartupScript(this, this.GetType(), "key", "alert(' Atleast select one domain !')", true); } else {//Your condition here
}
or u can use javascript check below
function doSubmit() { var c = document.getElementsByTagName('input'); for( var i = 0; i < c.length; i++ ) { if( c[i].type.toLowerCase() == 'checkbox' && c[i].checked ) { // A checkbox was checked, good user return( true ); } } // No checkbox checks, bad user return( false ); }
hope this helps u:)
这篇关于是否检查了checkboxlist的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文